SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Zealot
    Join Date
    Apr 2004
    Location
    Watford, UK
    Posts
    126
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    trying to keep div a min height, but expand if needed

    Hi,

    I'm trying to keep a div at a set height of 304 pixels so it aligns with an image, but allow it to expand (whilst keeping the white background intact) when a page has more content. I'm using the code below, but min-height does not work on much?!? An example of a page is at http://www.bacd.com/media2/index.php

    #content {
    position: absolute;
    left: 50%;
    width: 429px;
    top: 143px;
    margin-left: -51px;
    height:auto;
    background-color: #FFFFFF;
    z-index: 1;
    min-height: 304px;
    }

  2. #2
    SitePoint Enthusiast sbob's Avatar
    Join Date
    Jun 2005
    Location
    MN, USA
    Posts
    49
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That will work fine on good browers, such as Firefox. IE doesn't understand min-height, although it basically interprets height as min-height. So give IE the property of "height: 304px;" and it will work like "min-height: 304px;"

    Hide the height property from all browsers but IE with the * html hack, like this:
    Code:
      #content {
        position: absolute;
        left: 50%;
        width: 429px;
        top: 143px;
        margin-left: -51px;
        height:auto;
        background-color: #FFFFFF;
        z-index: 1;
        min-height: 304px;
        }
       * html #content {height: 304px;}
    ...and you should be good to go!

  3. #3
    SitePoint Zealot
    Join Date
    Apr 2004
    Location
    Watford, UK
    Posts
    126
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nice one, that works. I doesn't work on Safari (mac), but i'm not really fussed because only one or two pages will be shorter than the image on the left - cheers

  4. #4
    SitePoint Enthusiast sbob's Avatar
    Join Date
    Jun 2005
    Location
    MN, USA
    Posts
    49
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Do you have the latest version of Safari? I remeber reading about min/max-height support being added a while ago.

  5. #5
    SitePoint Zealot
    Join Date
    Apr 2004
    Location
    Watford, UK
    Posts
    126
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think so, my version is 1.3 (v312). I just looked on Apples website and it seems the latest on offer is 1.2 ???


Bookmarks

Posting Permissions

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