Hi all, I have tried creating the following html in a text editor as a css practice exercise. When I open the file in a browser, the background is white and not yellow as defined by the css. Can anyone see why this should be the case? Thanks <html> <head> <style type="text/css"> body {background-color: yellow} </style> </head> <body> <h1> My first page </h1> This is my first web page and I can say anything I want in here - I do that by putting text or images in the body section - where I'm typing right now </body> </html>
Try: <style type="text/css" media="screen"> Instead of: <style type="text/css"> As the user posted above you are also missing a ; , but this often doesn't have an effect if it's the last or the only property inside the list.
If it doesnt work add a comment in the css code, try this <style type="text/css"> <!-- body {background-color: yellow} --> </style>
Thanks for the suggestions. I tried the different ideas but the background still doesn't change to yellow for some reason.
What browser are you using. I copied your exact code that you posted to see for myself and it is showing up with a yellow background in both IE 7 and FF.?