How can I have a div of static 60px height in Internet Explorer?
If the contents are bigger then 60px, the div will auto-resize.
cypher
2010-09-26 19:06:32
+4
A:
<div style="height: 60px; overflow: hidden;">Hello, World</div>
Some versions of IE don't follow max-height, unfortunately, and that's where overflow: hidden
comes in handy. Note that the div will ALWAYS have 60px height no matter what's inside it.
cypher
2010-09-26 19:05:52
This is an excellent solution. Why is there scrollHeight instead of just height?
cypher
2010-09-26 19:12:24
"An element's scrollHeight is a measurement of the height of an element's content including content not visible on the screen due to overflow." - I'm sure clientHeight could also be used as well but I thought maybe this was necessary.
meder
2010-09-26 19:13:59
Expressions no longer work in IE9 and I thought they no longer worked in IE8 so this is a horrible idea.
Rob
2010-09-26 19:51:19