Flexible Box Layout

suggest change

Flexbox is a one-dimensional layout model for distributing and aligning items along a row or column.

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.toolbar__search {
  flex: 1 1 16rem;
  min-inline-size: 0;
}

.toolbar__actions {
  display: flex;
  gap: 0.5rem;
  margin-inline-start: auto;
}

Important container properties include:

Property Purpose
flex-direction Select the main-axis direction.
flex-wrap Allow items to form additional lines.
justify-content Distribute space along the main axis.
align-items Align items along the cross axis.
align-content Align multiple flex lines when extra cross-axis space exists.
gap Add space between items and lines.

Important item properties include flex, align-self, and order. The common flex: grow shrink basis shorthand controls how an item shares space.

min-inline-size: 0 is useful on flexible children that contain long text, because the default automatic minimum size can otherwise prevent them from shrinking.

Modern browsers use the unprefixed display: flex model. Do not mix it with the incompatible historical display: -webkit-box or display: -ms-flexbox syntaxes.

Changing order affects visual order but not the DOM, reading, or sequential focus order. Keep the source order meaningful.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents