I am currently workingon my School HTML and CSS code that I have experienced before, however even I tried various method such as copying teacher’s example or refer to my past project, my CSS code doesn’t work at my HTML, Do you know how to fix this?
(My past CSS code and HTML code works normally)
HTML code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
</head>
<link rel="stylesheet" type="text/css" href="Webstyle.css">
<body>
<div id="header">
<h1>Webpage Example</h1>
</div>
<div><img src="Myself.jpg" alt="Arata" height="300" class="center"> ##Allign to the right</div>
<br>
<div>
<p>・Self Introduction</p>
<p>・My work</p>
<p>・Contact</p>
</div>
<div>
<h1>Self Introduction</h1>
<p> My Name : ○○</p>
<p>My nationality : ○○</p>
<p>My age : ○○</p>
<p>Current job : ○○</p>
<p>Skill : Drawing</p>
<p>Hobby : Vudeo recordings, Video games</p>
<p>Favourite food :Fried food</p>
</div>
</body>
</html>
CSS code
@charset "UTF-8";
/* CSS Document */
#header{
background-colour : black;
color : white;
text-align:center;
padding:5px;
}
The CSS code should works normally to make the title of webpage as black background in white text and aligned in center. I tried to fix my refering to my past work.
3
Answers
The link element needs to be moved inside your head tag.
Changed
background-colour
tobackground-color
in css file.Moved the
<link>
tag inside the<head>
section.Example:
Note: Ensure the Webstyle.css file is in the same directory as your HTML file, or adjust the
href
attribute in the<link>
tag accordingly.You can check these things below:
<head></head>
section after the meta tags.Try above and check again!
See below image for naming the files: