Skip to content Skip to sidebar Skip to footer

Set Max-height On Inner Div So Scroll Bars Appear, But Not On Parent Div

I have my HTML, CSS set up as per the code below. I have also added a JSFiddle link since it will be far more convenient to see the code in action. The problem I'm having is that w

Solution 1:

If you make

overflow: hidden in the outer div and overflow-y: scroll in the inner div it will work.

http://jsfiddle.net/C8MuZ/11/

Solution 2:

This would work just fine, set the height to desired pixel

#inner-right{
            height: 100px;
            overflow:auto;
            }

Solution 3:

set this :

#inner-right {
    height: 100%;
    max-height: 96%;//change hereoverflow: auto;
    background: ivory;
}

this will solve your problem.

Solution 4:

It might be easier to use JavaScript or jquery for this. Assuming that the height of the header and the footer is 200 then the code will be:

functionSetHeight(){
    var h = $(window).height();
    $("#inner-right").height(h-200);    
}

$(document).ready(SetHeight);
$(window).resize(SetHeight);

Post a Comment for "Set Max-height On Inner Div So Scroll Bars Appear, But Not On Parent Div"