Div> Background not filling BG vertically

Discussion in 'Web Design and Development' started by kitki83, Nov 26, 2011.

  1. kitki83 macrumors 6502a

    Joined:
    Mar 31, 2004
    Location:
    Los Angeles
    #1
  2. brisbaneguy29 macrumors 6502

    brisbaneguy29

    Joined:
    Nov 27, 2007
    Location:
    Brisbane
    #2
    Why not give an overall wrapper a background colour to match the content colour?
     
  3. jared_kipe macrumors 68030

    jared_kipe

    Joined:
    Dec 8, 2003
    Location:
    Seattle
    #3
    it looks like div#wrapper might be intended to do it (though it doesn't have a background color)

    However it will require an actual hight, and since all the elements inside are floated, it doesn't really have one.

    Insert a <br style="clear: both;" /> after the close of div#extra and a background color to div#wrapper to do what you want it to do.
     
  4. Dolorian macrumors 65816

    Dolorian

    Joined:
    Apr 25, 2007
    #4
    You could just use:

    #container { background-color: #FFC; }

    That way it will fill up the entire area with that background color.
     
  5. kitki83 thread starter macrumors 6502a

    Joined:
    Mar 31, 2004
    Location:
    Los Angeles
    #5
    Thank you everyone, I knew it was something simple.
     
  6. mwilloam macrumors newbie

    Joined:
    Apr 3, 2010
    #6
    I can't see your page as it seems to be offline but another possible fix is to set the containing elements overflow to: "auto". That should vertically expand the container to content height. Otherwise you could also float the container the same as the contained elements, but that may mess with it if you are auto margining to the center. Again, I can't see it.
     

Share This Page