0

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;

}
1
  • 3
    background: red; remove the hash, hashes are only used for hexadecimal colours Commented Jun 4, 2016 at 10:40

2 Answers 2

3

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;
Sign up to request clarification or add additional context in comments.

Comments

1

Named colors do not need hash sign:

body{
background:red;
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.