Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Jan 2012
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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.

  • #2
    Regular Coder
    Join Date
    Dec 2011
    Location
    NW England
    Posts
    194
    Thanks
    8
    Thanked 15 Times in 15 Posts
    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?

  • #3
    New to the CF scene
    Join Date
    Jan 2012
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #4
    Regular Coder
    Join Date
    Dec 2011
    Location
    NW England
    Posts
    194
    Thanks
    8
    Thanked 15 Times in 15 Posts
    I think your going to have to just set each div to
    Code:
    background-color: white;

  • #5
    New Coder
    Join Date
    Jan 2012
    Location
    Romania
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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;
    }

  • #6
    New to the CF scene
    Join Date
    Jan 2012
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    hm, didn't work. Must have done something wierd in either html or css.

    But I start over, it's good practise

    Thanks anyway


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •