<h1>flex-shrink: 1;</h1>
<section class="container">
<div class="item shrink-1">1</div>
<div class="item shrink-1">2</div>
<div class="item shrink-1">3</div>
<div class="item shrink-1">4</div>
</section>
<h1>flex-shrink: 1; // Conteúdo diferente</h1>
<section class="container">
<div class="item shrink-1">1</div>
<div class="item shrink-1">Teste 2</div>
<div class="item shrink-1">Oi 3</div>
<div class="item shrink-1">4</div>
</section>
<h1>flex-shrink: misturado; // Conteúdo diferente</h1>
<section class="container">
<div class="item shrink-1">1</div>
<div class="item shrink-1">Teste 2</div>
<div class="item shrink-3">Oi 3</div>
<div class="item shrink-3">4</div>
</section>
<h1>flex-shrink: 1; // Conteúdo maior que o container</h1>
<section class="container">
<div class="item shrink-1">TesteTesteTesteTeste</div>
<div class="item shrink-1">TesteTesteTeste 2</div>
<div class="item shrink-1">Oi 3</div>
<div class="item shrink-1">4</div>
</section>
<h1>flex-shrink: misturado; // Conteúdo maior que o container</h1>
<section class="container">
<div class="item shrink-1">TesteTesteTesteTeste</div>
<div class="item shrink-1">TesteTesteTeste 2</div>
<div class="item shrink-3">Oi 3</div>
<div class="item shrink-3">4</div>
</section>
<h1>flex-shrink: 1; / flex-basis: valor;</h1>
<section class="container">
<div class="item shrink-1-basis">TesteTesteTesteTeste</div>
<div class="item shrink-1-basis">TesteTesteTeste 2</div>
<div class="item shrink-1-basis">Oi 3</div>
<div class="item shrink-1-basis">4</div>
</section>
<h1>flex-shrink: 0; / flex-basis: valor;</h1>
<section class="container">
<div class="item shrink-0-basis">TesteTesteTesteTeste</div>
<div class="item shrink-0-basis">TesteTesteTeste 2</div>
<div class="item shrink-0-basis">Oi 3</div>
<div class="item shrink-0-basis">4</div>
</section>
<h1>flex-shrink: 0; / flex-basis: valor; / wrap</h1>
<section class="container flex-wrap">
<div class="item shrink-0-basis">TesteTesteTesteTeste</div>
<div class="item shrink-0-basis">TesteTesteTeste 2</div>
<div class="item shrink-0-basis">Oi 3</div>
<div class="item shrink-0-basis">4</div>
</section>
<h1>flex-shrink: misturado; / flex-basis: valor;</h1>
<section class="container">
<div class="item shrink-1-basis">1</div>
<div class="item shrink-1-basis">Teste 2</div>
<div class="item shrink-3-basis">3</div>
<div class="item shrink-3-basis">4</div>
</section>
<h1>flex-shrink: misturado; / flex-basis: valor; / wrap</h1>
<section class="container flex-wrap">
<div class="item shrink-1-basis">1</div>
<div class="item shrink-1-basis">Teste 2</div>
<div class="item shrink-3-basis">3</div>
<div class="item shrink-3-basis">4</div>
</section>
.shrink-1 {
flex-grow: 1;
flex-shrink: 1;
}
.shrink-3 {
flex-grow: 1;
flex-shrink: 3;
}
.shrink-1-basis {
flex-grow: 1;
flex-shrink: 1;
flex-basis: 150px;
}
.shrink-0-basis {
flex-grow: 1;
flex-shrink: 0;
flex-basis: 150px;
}
.shrink-3-basis {
flex-grow: 1;
flex-shrink: 3;
flex-basis: 150px;
}
.flex-wrap {
flex-wrap: wrap;
}
.item {
margin: 5px;
background: tomato;
text-align: center;
font-size: 1.5em;
}
/* Flex Container */
.container {
max-width: 400px;
margin: 0 auto;
display: flex;
border: 1px solid #ccc;
}
/* Flex Item */
h1 {
text-align: center;
margin: 20px 0 0 0;
font-size: 1.25em;
font-weight: normal;
}
body {
font-family: monospace;
color: #333;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.