views:

4293

answers:

5

My site, a course catalog tool for universities, has a center pane that contains a dynamically updated list of classes. In Firefox, Opera, and Chrome, the center pane has the intended scrolling behavior: when the class list exceeds the height, the center pane has a scroll bar. IE, however, only shows this bar when the height is explicitly set. Without using JavaScript to reset the center pane height on resize, how can I force Internet Explorer to show the scroll bar?

The center pane:

<div id='middlenav'>
    <div id='middleheader'></div>
    <div id='courselist'></div>
</div>

and its CSS:

div#middlenav
{
    position: absolute;
    left: 250px;
    right: 350px;
    top: 0px;
    bottom: 0px;
}

div#courselist
{
    overflow: auto;
    position: absolute;
    top: 55px;
    bottom: 0px;
    width: 100%;
}

It looks like the center pane isn't obeying the bottom: 0px; statement, and is expanding to the full height of the contained #courselist. I tried body { height: 100% } but that didn't fix it.

Thanks!

A: 

position: absolute; bottom: 0px; sets the element right on the bottom of the element. But it has to know where the bottom of the element is. If you set the height to 100% or have it in another element positioned bottom: 0px; Then it doesn't know where the bottom is, unless one of those elements is inside (taking up the full height of) and element with a fixed size. You can't give the body a height of 100% because it would just sort of go on forever. Try specifying the height of the body or some containing element. :D

CrazyJugglerDrummer
The location of the bottom of the element will be calculated in the normal way. In this case #middlenav should span the height of the window (unless there is another element with position: not-static; in the way).
David Dorward
A: 

very smart answer CrazyJugglerDrummer, but how about the situation when you can't set a fixed height, because you want the page to take the full size of the window?

Max
A: 

Ensure that your doctype is set to HTML strict, otherwise IE will behave quirky and get confused with under each positioning and overflows.

Add this to top of your page:

<!doctype html>
BalusC
A: 

Hey dude dont use top and bottom positioning in the same class, as well not dont use right and left positioning in the same class, as they are contradictory values to each other.

Navi
No, they aren't. With position: absolute, which is being used here, `left` sets the position of the left edge from the left, `right` sets the position of the right edge from the right, and so on.
David Dorward
A: 

While it is perfectly acceptable to set opposite edges when using absolute positioning in CSS, limitations in Internet Explorer mean that the approach may not work there.

There is no way to avoid the bug in Internet Explorer 6. In Internet Explorer 7 and newer, triggering Standards Mode will resolve the issue.

Faking columns that extend to the bottom of an element is usually achieved using faux columns.

David Dorward