www.webdeveloper.com
Results 1 to 4 of 4

Thread: [RESOLVED] CSS Miinumum height question

  1. #1
    Join Date
    Mar 2004
    Location
    Nevada, USA
    Posts
    201

    resolved [RESOLVED] CSS Miinumum height question

    I am designing a website you can see here:
    http://www.lawrence-nv.us/fashiondes...gners/Davis-B/

    I have a content area located below the navigation bar. I have a CSS statement for this content that says min-height: 50px; with background-color: white;

    Within this content DIV area I have two Divs, one called Leftbox and one called Right box. In each of these boxes I have a bunch of <br> followed by &nbsp; just to give the boxes some height. These boxes have position: absolute, and are within the content area which has position: relative.

    As you can see, the leftbox and rightbox have made the content area height to contain these boxes, yet the background color is only 50 pixels high.

    How do I get the background color of the content area to fill the complete content area?

    The reason I set it up this way is because I will have many pages like this where the amount of text and photos in each of the leftbox and rightbox will be different on each page, and I want the content area pushed down to keep the footer at the bottom, but I also want the color of the content area to fill the complete content area.

    The colors I have shown are just so I can see where the different elements are located.
    Last edited by lkeeney; 05-11-2012 at 11:34 PM.
    Larry

  2. #2
    Join Date
    Mar 2012
    Posts
    48
    if you are using the float element you should use it on the element that contains it.
    put float:left selector on your container and set its width to 100&#37;
    so it will cover all the middle section and the other element will get in place.

    a question- why is your main element that should be contain all your side only containing the header of your site?

  3. #3
    Join Date
    Sep 2006
    Location
    new york
    Posts
    266

    some references

    See http://net.tutsplus.com/tutorials/ht...must-memorize/



    The Great Collapse

    One of the more bewildering things about working with floats is how they can affect the element that contains them (their "parent" element). If this parent element contained nothing but floated elements, the height of it would literally collapse to nothing. This isn't always obvious if the parent doesn't contain any visually noticeable background, but it is important to be aware of.

    The Overflow Method relies on setting the overflow CSS property on a parent element. If this property is set to auto or hidden on the parent element, the parent will expand to contain the floats, effectively clearing it for succeeding elements. This method can be beautifully semantic as it may not require an additional elements. However if you find yourself adding a new div just to apply this, it is equally as unsemantic as the empty div method and less adaptable. Also bear in mind that the overflow property isn't specifically for clearing floats. Be careful not to hide content or trigger unwanted scrollbars.
    or, as suggested, float parent also.

    See also http://www.w3schools.com/css/css_float.asp http://coding.smashingmagazine.com/2...loat-property/

  4. #4
    Join Date
    Mar 2004
    Location
    Nevada, USA
    Posts
    201
    Thank you both for your input. I have been working with CSS for years, and have never run into this problem before. However, I do not use "float" that much.
    Larry

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles