Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-28-2012, 02:08 PM   PM User | #1
Thicky
New to the CF scene

 
Join Date: Jan 2012
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Thicky is an unknown quantity at this point
Help with css for divs!

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:
PHP Code:
#white {
    
background-color:#FFF;
    
height:100%;
    
width:800px;
    

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

Last edited by Thicky; 01-28-2012 at 06:04 PM..
Thicky is offline   Reply With Quote
Old 01-28-2012, 02:22 PM   PM User | #2
melloorr
Regular Coder

 
Join Date: Dec 2011
Location: NW England
Posts: 194
Thanks: 8
Thanked 15 Times in 15 Posts
melloorr is an unknown quantity at this point
So, you want all of your website gray, except for the content, which should be white? you can do that with:
Code:
body{
    background-color: gray;
}
Then set the content as white.
Or do you mean something like a wrapper?
melloorr is offline   Reply With Quote
Old 01-28-2012, 02:26 PM   PM User | #3
Thicky
New to the CF scene

 
Join Date: Jan 2012
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Thicky is an unknown quantity at this point
Quote:
Originally Posted by melloorr View Post
So, you want all of your website gray, except for the content, which should be white? you can do that with:
Code:
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
Thicky is offline   Reply With Quote
Old 01-28-2012, 02:29 PM   PM User | #4
melloorr
Regular Coder

 
Join Date: Dec 2011
Location: NW England
Posts: 194
Thanks: 8
Thanked 15 Times in 15 Posts
melloorr is an unknown quantity at this point
I think your going to have to just set each div to
Code:
background-color: white;
melloorr is offline   Reply With Quote
Old 01-28-2012, 02:43 PM   PM User | #5
nameno
New Coder

 
Join Date: Jan 2012
Location: Romania
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
nameno is an unknown quantity at this point
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;
}
nameno is offline   Reply With Quote
Old 01-28-2012, 03:03 PM   PM User | #6
Thicky
New to the CF scene

 
Join Date: Jan 2012
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Thicky is an unknown quantity at this point
hm, didn't work. Must have done something wierd in either html or css.

But I start over, it's good practise

Thanks anyway
Thicky is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:51 PM.


Advertisement
Log in to turn off these ads.