Myforwik
Myforwik

Reputation: 3588

CSS fixed div max height in IE?

I have a fixed div setup using this:

.box {
position: fixed;
width: 600px;
bottom: 20px;
left: 50%;
max-height: 400;
overflow:auto;
}

The problem I have is that on internet explorer it ignores the max-height, the div just expands upwards and out of view with no scroll bars, even if I set overflow: scroll;.

BTW I am using the hack to do fixed absolute position boxes so they stay on the screen reguardless of scrolling, if that matters:

* { margin: 0; }
* html .box { position: absolute; }

Upvotes: 3

Views: 4726

Answers (1)

Michael Rader
Michael Rader

Reputation: 5957

try this:

* html .box{ 
height: expression( this.scrollHeight > 399 ? "400px" : "auto" ); /* fix for ie 5+ */
}
.box {
max-height: 400px; 
position: fixed;
width: 600px;
bottom: 20px;
left: 50%;
overflow:auto;
}

Upvotes: 2

Related Questions