max-height

Discussion in 'HTML' started by Erik Ginnerskov, Dec 24, 2004.

  1. I have been struggling for some time, trying to make IE behave as if it
    actually do understand the css attribute max-height.

    In FireFox this code vill work perfectly:

    <div style="width: 300px; max-height: 60px; overflow:auto">Some
    text</div>

    If the amount of text isn't enough to fill out the space, the box decreases
    til fit the text. If the amount of text exceeds the height defined, the box
    will get a scroll bar.

    IE does not understand that and the height of the box depends solely on the
    amount of content.

    I have come up with a hack (placed in header), that limits the height in IE
    too:

    <!--[if IE]>
    <style type="text/css" media="screen">
    #maxi {
    height:expression(
    document.body.clientHeight > (100/12) *
    parseInt(document.body.currentStyle.fontSize)?
    "60px":
    "auto" );
    }
    </style>
    <![endif]-->

    But when the amount of text doesn't fill out the specified height, all that
    happens is, the scroll bar dissapears. The box is still at the max height.

    Anyone who knows how to make IE do as wanted?

    --
    Yours
    Erik Ginnerskov
    http://hjemmesideskolen.dk - http://html-faq.dk
    http://ginnerskov.frac.dk
     
    Erik Ginnerskov, Dec 24, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Erik Ginnerskov

    max-height

    Erik Ginnerskov, Dec 24, 2004, in forum: HTML
    Replies:
    9
    Views:
    18,984
    Erik Ginnerskov
    Dec 25, 2004
  2. Erik Ginnerskov

    max-height

    Erik Ginnerskov, Dec 24, 2004, in forum: HTML
    Replies:
    0
    Views:
    482
    Erik Ginnerskov
    Dec 24, 2004
  3. Summercool
    Replies:
    9
    Views:
    912
    dorayme
    Oct 23, 2007
  4. Greg Ferris

    Textarea max rows and max characters per row

    Greg Ferris, Jan 16, 2004, in forum: Javascript
    Replies:
    2
    Views:
    619
    Greg Ferris
    Jan 16, 2004
  5. kriton
    Replies:
    0
    Views:
    360
    kriton
    Apr 22, 2005
Loading...

Share This Page