I have a CSS grid with a row div
for a header, a row div
for content, and a row div
for a footer. I want the content to fill the screen but keep the header and footer visible. I have a fixed-size div
inside another div
inside the content div
. Everything except the fixed-size div
is height: 100%
.
If I apply overflow-y: auto
to the content div
, the scrollbar appears on the content div
. This is great, but what I really want is for the scrollbar to appear on the div
inside the content div
instead.
https://jsfiddle.net/efth2akr/2/
If I apply overflow-y: auto
to the div
inside the content div
instead, there is no scrollbar and the content div
takes on the height of the fixed-size div
. This pushes the footer down and puts a scrollbar on the whole page. What?? Isn't height: 100%
supposed to be based on the parent height? Other questions that describe similar scenarios fail to put height: 100%
all the way up the chain, but I haven't.
https://jsfiddle.net/t08u9wnk/2/
How can I achieve my desired behavior of having the scrollbar appear on the div
inside the content div
while maintaining a responsive layout? What am I not understanding about height: 100%
in this scenario?
Browser: Microsoft Edge 103.0.1264.62