Flexbox Example Nine

Example: flex-grow, flex-shrink, and flex-basis

Resize the viewport

Box 1

Box 2

Box 3

Box 4

Box 5

Box 6

Box 7

Box 8

HTML

<div class="container">
    <p class="box">Box 1</p>
    <p class="box">Box 2</p>
    <p class="box">Box 3</p>
    <p class="box">Box 4</p>
    <p class="box">Box 5</p>
    <p class="box">Box 6</p>
    <p class="box">Box 7</p>
    <p class="box">Box 8</p>
</div>

CSS

.container {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-around;
    align-items: flex-start;
    align-content: flex-start;
    background-color: yellow;
    border: thin solid black;
    width: 80%;
    height: 400px;
    align-content: flex-end;
}

.box {
    flex-grow: 1;
    flex-shrink: 1;
    flex-basis: 200px;
    background-color: aliceblue;
    border: thin solid black;
}