max-height

E

Erik Ginnerskov

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?
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top