My desired layout is a box center in the HTML body with 50% height (50vh) and width, with two equal width columns, and if the content in either column becomes larger than its own height, a vertical scrollbar is shown.
I have the following fiddle. The left column in the display: grid
div has id #col1
. What I noticed is that if I set its height to 100%
then its height will grow to fit the text within it.
I don't understand why. I'm saying that #gridContainer
has a height of 100%
of its parent #flexContainer
. So shouldn't giving #col1
a height of 100%
have it match its parent #gridContainer
?
I notice that if I change display: grid
to display: block
in the #gridContainer
selector, I will get the vertical scroll bars whether I give #col1
the height: 100%
rule or not.
Is this something to do with how css-grid interacts with the height css property that I'm not getting?