Rows with Flexbox
Esta página precisa de um navegador recente (com suporte a SharedArrayBuffer). Por favor, atualize Chrome, Edge, Firefox ou Safari para a versão mais recente.
English
Putting boxes in a row
- By default, boxes stack downward. Often you want them side by side.
- Flexbox is the easy way to do that.
- Put
display: flex;on the container — the box that holds the others — and its children line up in a row.

English
Spacing them out
- Once a box is
display: flex;, you control how its children spread. justify-content: space-between;pushes them apart, with gaps between.gap: 12px;adds an even space between every child.
English
<style>
.bar { display: flex; justify-content: space-between; }
.btn { background-color: #6c5; padding: 10px 16px; }
</style>
<div class="bar">
<span class="btn">Home</span>
<span class="btn">About</span>
<span class="btn">Contact</span>
</div>
English
Common mistakes
display: flexgoes on the container, not on the items.justify-contentspaces items along the row.
English
Now you try
display: flexgoes on the container, not the items.- Turn a box into a row, then spread its children out.
Explorar
Flexbox lays out a row
justify-content spaces items along the row; align-items across it.
Dificuldade 3/5 · Moedas 200 + pequeno bônus na primeira conclusão hoje
Put the three boxes side by side. Add display: flex; to the .row rule.
Dificuldade 3/5 · Moedas 200 + pequeno bônus na primeira conclusão hoje
Spread the boxes evenly across the row. Add justify-content: space-between; to the .row rule.
Dificuldade 3/5 · Moedas 200 + pequeno bônus na primeira conclusão hoje
Make a row of tags with even gaps: give .tags display: flex; e gap: 12px;.