Loading...

CSS essentialsLayout

Flexbox layout

7 min lesson

Next

Flexbox arranges items along one main axis and helps distribute space. Set display: flex on a parent, then use properties such as gap, align-items, and justify-content.

Keep in mind

Use gap for consistent spacing between items instead of adding margins to every child.

styles.css
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

What happens: Toolbar items line up and spread across the available width.

Previous
Next