Coder1234
Coder1234

Reputation: 409

Why won't my css file link to my html file?

Here is my html code :---------------------------------------------------

<!doctype html> 
<html>

<head> 
<title>My webpage </title>
 <link rel="stylesheet" type="text/css" href="style.css"/>

</head>

<body>
<h1> My website </h1>

<ul>
<li> Home</li>
<li><a href="page2.html"> page 2</a>  </li>
<li><a href="page3.html"> page 3</a> </li>
</ul>
<h2> This is my homepage</h2>
<p> All of my homepage content</p>
</body>

</html>  

the background is suppose to go red but doesn't ?

css code from another file:

body{
background:#red;

}

Upvotes: 0

Views: 67

Answers (2)

Karl
Karl

Reputation: 5463

When using a named colour you do not need to use a hash, hashes are only used for hexadecimal colours.

In order to change the background to red, use the following code:

background: red;

Or, you can do this (#ff0000 is the hexadecimal code for red):

background: #ff0000;

Upvotes: 3

Ali Sheikhpour
Ali Sheikhpour

Reputation: 11055

Named colors do not need hash sign:

body{
background:red;
}

Upvotes: 1

Related Questions