<div class="flex-container space-between" style="width: 100%; justify-content: space-around;">
<div class="side flex-col flex-container">
<h1>Shrinking items</h1>
<h2>
shrink (container direction: row)
<small>
All items have flex-grow: 1; flex-basis: 150px
</small>
</h2>
<div class="flex-container">
<div style="flex-shrink: 1; flex-grow: 1; flex-basis: 120px">
shrink: 2
</div>
<div style="flex-shrink: 0; flex-grow: 1; flex-basis: 120px">shrink: 0</div>
<div style="flex-shrink: 0; flex-grow: 1; flex-basis: 120px">shrink: 0</div>
</div>
<h2>
shrink (container direction: column)
<small>
All items have flex-grow: 1; flex-basis: 100px
</small>
</h2>
<div class="flex-col flex-container" style="height: 300px">
<div style="flex-shrink: 1; flex-grow: 1; flex-basis: 100px">
shrink: 2
</div>
<div style="flex-shrink: 0; flex-grow: 1; flex-basis: 100px">shrink: 0</div>
<div style="flex-shrink: 0; flex-grow: 1; flex-basis: 100px">shrink: 0</div>
</div>
</div>
</div>
.flex-container {
display: flex;
margin-bottom: 15px;
}
/* General styles */
small {
font-style: italic;
display: block;
font-size: .75em;
color: gray;
}
.flex-row {
flex-direction: row;
}
.flex-col {
flex-direction: column;
}
.side {
min-width: 250px;
}
.side + .side {
margin-left: 15px;
}
.side .flex-container {
background-color: lightblue;
border: 2px solid #000;
}
.side .flex-container div {
background-color: lightgreen;
padding: 10px;
text-align:center;
border: 2px solid lightblue;
}
h1, h2 {
margin-top: 0;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.