在以下内容中,我注意到Firefox和Chrome中的滚动行为不同。在Firefox中,只有.main
滚动,而在Chrome中,整个滚动。我在做一些不合规格的事情吗?哪种浏览器正确?如何使Chrome表现得像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>
答案 0 :(得分:1)