Jump to content

css background colour


helen stunell

Recommended Posts

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

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

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

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

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...