...

View Full Version : Resolved Help with css for divs!



Thicky
01-28-2012, 03:08 PM
Hi there, Sorry for my bad english, but I hope you can help me anyway ^^

I'm working on a website for fun and having a problem with div.
I created a div id tag at top of my website right under <body> and closed it right before </body> so I can have all my content in white background and the rest of it around in a grey color. But when I add a white background to the tag I get something looking like this:
The white background stop right under the top. BUt I want it to end at the bottom right before the footer. I could add a height to it and that works. But then if I add more text I will have to change the width manualy each time :/

This is how my css code looks like:
#white {
background-color:#FFF;
height:100%;
width:800px;

}

I read somewhere that this could be caused of float:left/right which I'm useing.

melloorr
01-28-2012, 03:22 PM
So, you want all of your website gray, except for the content, which should be white? you can do that with:

body{
background-color: gray;
}

Then set the content as white.
Or do you mean something like a wrapper?

Thicky
01-28-2012, 03:26 PM
So, you want all of your website gray, except for the content, which should be white? you can do that with:

body{
background-color: gray;
}

Then set the content as white.
Or do you mean something like a wrapper?

oh, forgot to mention, I already set the background color to grey. Yeah, a wrapper. Everything between top bar and footer should be with white background

melloorr
01-28-2012, 03:29 PM
I think your going to have to just set each div to
background-color: white;

nameno
01-28-2012, 03:43 PM
create a new div:

Html
Top bar

<div id="content"><!--this is the new div-->
put all the content you have between top bar and footer here
</div>

Footer


CSS
#content {
background-color: white;
width: 800px;
}

Thicky
01-28-2012, 04:03 PM
hm, didn't work. Must have done something wierd in either html or css.

But I start over, it's good practise :)

Thanks anyway



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum