Flexbox Basics
Set display: flex on a container and its children line up in a row. justify-content spaces them along the row and align-items aligns them across it.
Use gap for spacing between items. Flexbox is ideal for navigation bars, toolbars, cards in a row and centring.
Example
<style>
.row {
display: flex;
gap: 12px;
justify-content: space-between;
align-items: center;
}
.row div { background: #dcfce7; padding: 16px; border-radius: 6px; }
</style>
<div class="row">
<div>One</div>
<div>Two</div>
<div>Three</div>
</div>Exercise
Turn the container into a flex container.
.row { display: ; }
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.