In the interface below, the (parent) .panel (styled using flex) won't scroll below the bottom edge of the last (child) .item even though the last .item (like the all the others) should have a margin-bottom of 12px.
That's what I'm trying to achieve:
When I scroll down, I want to see the 12px bottom margin of the last .item.
Here's the interface:
.interface {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
padding: 60px 0;
font-family: sans-serif;
color: rgb(255, 255, 255);
background-color: rgb(159, 0, 0);
opacity: 1;
}
.header,
.footer {
position: fixed;
left: 0;
z-index: 12;
width: 100%;
height: 60px;
line-height: 60px;
text-align: center;
background-color: rgb(159, 0, 0);
box-shadow: 0 0 6px rgba(15, 0, 0, 0.4);
}
.header {
top: 0;
}
.heading {
margin: 0;
padding: 0;
}
.footer {
bottom: 0;
}
.credit {
margin: 0;
padding: 0;
}
.intro {
height: 60px;
margin: 0;
padding: 0;
line-height: 60px;
font-size: 20px;
text-transform: uppercase;
text-align: center;
background-color: rgba(127, 0, 0, 0.4);
box-shadow: 0 0 6px rgba(15, 0, 0, 0.4);
}
.panel {
display: flex;
justify-content: center;
align-items: center;
flex-wrap: wrap;
height: calc(100vh - 180px);
padding-top: 12px;
overflow-y: scroll;
box-sizing: border-box;
transform: translateY(0);
}
.item {
flex: 0 1 30vw;
height: 160px;
margin: 12px;
line-height: 160px;
text-align: center;
text-shadow: 1px 1px 1px rgba(31, 0, 0, 0.4);
background-color: rgba(47, 0, 0, 0.4);
border: 1px solid rgb(95, 0, 0);
}
@media only screen and (max-width: 906px) {
.item {
flex: 0 1 44vw;
}
}
@media only screen and (max-width: 590px) {
.item {
flex: 0 1 96vw;
}
}
<aside class="interface">
<header class="header">
<h2 class="heading">Title</h2>
</header>
<p class="intro">Text-based introduction here.</p>
<div class="panel">
<div class="item">Item 1</div>
<div class="item">Item 2</div>
<div class="item">Item 3</div>
<div class="item">Item 4</div>
<div class="item">Item 5</div>
<div class="item">Item 6</div>
<div class="item">Item 7</div>
<div class="item">Item 8</div>
<div class="item">Item 9</div>
</div>
<footer class="footer">
<p class="credit">Credit</p>
</footer>
</aside>
N.B. Open the Code Snippet above to Full page.