1

ive been watching a tutorial that has told me to change the background color of a webpage by using:

body {background-color:red;} 

however when i try and load the page in google chrome the background remains white?

This is my full code:

<!doctype html> <html> <!--Document START--> <head> <!--Head START--> <title>Page Title</title> <style type="text/css"> <!--CSS START--> body { background-color:red } </style> </head> <body> <!--Body START--> <h1>Page Title</h1> </body> </html> 
1
  • works for me as it should : jsbin.com/azajen Commented Jun 17, 2012 at 13:07

4 Answers 4

4

The problem is you have an html comment within your css.

<style type="text/css"> <!--CSS START--> 

Remove the <!--CSS START--> and it will work fine.

If you want to add comments within css then you can use /* */, e.g:

<style type="text/css"> /* CSS START */ 
Sign up to request clarification or add additional context in comments.

Comments

0

This works for you.

 body { background:red; } 

Comments

0

Ahhh yes, the problem is you have a html comment in the css, so it will not work after: –

Comments

0

Should be:

body { background-color:red; } 

(You forgot the ; after "red")

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.