helen stunell Posted October 11, 2006 Share Posted October 11, 2006 I am creating a CSS for a website and I have used the following code:<head><style type="text/css"></head>body{background-color:yellow}h1 {background-color: transparent}h2 {background-color: transparent}p {background-color: rgb(250,0,255)}</style>all the code works apart from body{background-color: yellow} i can't understand why it won't work - its the same as the code W3c tells you to use. can anyone help? Link to comment Share on other sites More sharing options...
designationlocutus Posted October 11, 2006 Share Posted October 11, 2006 I am creating a CSS for a website and I have used the following code:<head><style type="text/css"></head>body{background-color:yellow}h1 {background-color: transparent}h2 {background-color: transparent}p {background-color: rgb(250,0,255)}</style>all the code works apart from body{background-color: yellow} i can't understand why it won't work - its the same as the code W3c tells you to use. can anyone help?Hmm try placing your closing head tag after your closing style tag. Link to comment Share on other sites More sharing options...
helen stunell Posted October 11, 2006 Author Share Posted October 11, 2006 Hmm try placing your closing head tag after your closing style tag.[/quoteI've tried that & it still won't work Link to comment Share on other sites More sharing options...
scott100 Posted October 11, 2006 Share Posted October 11, 2006 It works fine, it should look like this<head><style type="text/css">body{background-color:yellow}h1 {background-color: transparent}h2 {background-color: transparent}p {background-color: rgb(250,0,255)}</style></head> http://www.w3schools.com/css/tryit.asp?fil...ackground-color Link to comment Share on other sites More sharing options...
helen stunell Posted October 11, 2006 Author Share Posted October 11, 2006 It works fine, it should look like this<head><style type="text/css">body{background-color:yellow}h1 {background-color: transparent}h2 {background-color: transparent}p {background-color: rgb(250,0,255)}</style></head> http://www.w3schools.com/css/tryit.asp?fil...ackground-color I've tried it & it still won't work, my code looks exactly the same. ggggrrrrr!!!! Link to comment Share on other sites More sharing options...
aspnetguy Posted October 11, 2006 Share Posted October 11, 2006 post the code for the whole page...the CSS is fine you must be doing something wrong in the HTML Link to comment Share on other sites More sharing options...
helen stunell Posted October 13, 2006 Author Share Posted October 13, 2006 This is as far as i have got. If I'm doing something wrong please tell me. I'm pretty sure its how it should be.thanx <html><head><link rel="stylesheet" style type="text/css" href="style.css" /></head><body><h1> </h1></body></html> Link to comment Share on other sites More sharing options...
aspnetguy Posted October 13, 2006 Share Posted October 13, 2006 change this <link rel="stylesheet"style type="text/css" href="style.css" /> to <link rel="stylesheet" type="text/css" href="style.css" /> style.css must be in the same folder as the page you are linking it to Link to comment Share on other sites More sharing options...
helen stunell Posted October 13, 2006 Author Share Posted October 13, 2006 yeah tried that its still not working! My css file is in the same folder as my html file so thats not the problem. I really don't understand why the only part of the code that doesn't work is the background color. The code for the header etc works fine.Strange as it may sound, if i open my html file in open office word it work perfectly, background colour and everything so it obviously works just not in a browser! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now