Results 1 to 7 of 7

Thread: IE has problems displaying MIN-Height

  1. #1
    Join Date
    Feb 2007
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default IE has problems displaying MIN-Height

    Finally i found out how to set a min-height to my pages and i've got a problem!
    FireFox perfectly displays the divs, the height i specified, but IE6 scrolls down to the infinite, and i dont know how to stop it.
    is there anyway to solve it? with a max height or something????

    Here is the CSS code i used:

    Code:
    #bodycontent {
    	
    	float: right;
    	background-color: #fefaf6;
    	border: solid 1px yellow;
    	border-left: solid 1px red;
    	border-top: solid 2px red;
    	width: 590px;
    	min-height: 600px;
    	max-height: 1024px;
    	padding: 18px 0 16px -250px;
    	margin: -20px 0 0 -20px;		
    }
    * html #bodycontent {
    height:expression(Math.max(this.offsetHeight-2, 600)+'px');
    }

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    It would be something like:

    Code:
    height:expression(Math.min(1024, (Math.max(this.offsetHeight-2, 600))+'px');
    However, a layout that is dependant upon max and/or min dimensions may be able to be simplified so as to not require them. If so, that is the way to go.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Feb 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I'm not positive if this is the info you're looking for, but this is a cross browser hack that fixes min-height.


    div {
    min-height:100px;
    height:auto !important;
    height:100px;
    }

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by andrewmta View Post
    I'm not positive if this is the info you're looking for, but this is a cross browser hack that fixes min-height.


    div {
    min-height:100px;
    height:auto !important;
    height:100px;
    }
    That seems to work out well in a simple trial!
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Feb 2007
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default It Worked!

    Hey man,
    thanks a lot, this really helped me fix that problem, and now it's perfect!

  6. #6
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Yes, IE ignores min-width and min-height because it expands elements past their width and height if necessary. Thus, width and height in IE behave like min-width and min-height in other browsers. The only problem is that there's nothing that behaves like width and height do in other browsers in IE
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  7. #7
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Yes, except for IE 7. Fortunately that and the other browsers use the min-height and the !important style. However, if there were to be a later style for width for that element, they would also ignore it while IE 6 and earlier would follow it. That is a potential problem.

    In a somewhat related matter. When I tested this out (using a 1px solid red border as an aid to gauge the height of the elements visually), I used one div with a short line of text in it and another with a huge image. The one with the short text behaved exactly as expected in several browsers. However the one with the image respected the height of the image in all browsers but, not its width. All except IE 6 cut off the division at the end of the viewable portion of the body element, even though there was a horizontal scrollbar present.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

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
  •