Try lowering the width of the browser until the border for .cards
hits the card the furthest to the right. Notice that that none of the cards shrink and stays inside, instead they overflow.
Why is that? I explicitly set the flex-shrink
property to 3.
.cards {
display: flex;
align-content: center;
border: 1px solid black;
width: 80vw;
}
.card {
flex-shrink: 3;
flex-grow: 0;
flex-basis: 0;
height: 150px;
width: 250px;
}
#karma-card {
background: yellow;
}
#calculator-card {
background: blue;
}
#supervisor-card {
background: green;
}
#team-builder-card {
background: red;
}
<div class="cards">
<div id="supervisor-card" class="card">
Supervisor
</div>
<div>
<div id="team-builder-card" class="card">
Team Builder
</div>
<div id="karma-card" class="card">
Karma
</div>
</div>
<div id="calculator-card" class="card">
Calculator
</div>
</div>
Bonus question: Now we're at it, for some reason, the align-content: center
property doesn't work either. I expect the green and blue card to being centered vertically (because they have more space along the cross axis).