I noticed different scrolling behaviour in Firefox and Chrome in the following snipped. In Firefox only the .main
scrolls, in Chrome, the whole body scrolls. Am I doing something not to spec? Which browser is right? How can I get Chrome to behave like Firefox?
https://jsfiddle.net/Lgzb45np/
body {
height: 100vh;
}
.container {
display: grid;
grid-template: 50px 1fr / 240px 1fr;
height: 100%;
}
.header {
grid-area: 1/1;
}
.sidebar {
grid-area: 2/1;
}
.main {
grid-area: 2/2;
height: 100%;
overflow: auto;
}
.large-div{
height: 800px;
}
<div class="container">
<div class="header">Some Header Row</div>
<div class="sidebar">A Sidebar</div>
<div class="main">
<div class="large-div">This is large</div>
And Some More</div>
</div>
Removing the height: 100%
from .main
should work. You already define the height size of the .main
column (1fr)
CSS
.main {
grid-area: 2/2;
overflow: auto;
}