Flexbox

Flexbox is (aside from optional wrapping) a single-direction layout concept. Think of flex items as primarily laying out either in horizontal rows or vertical columns.

topics

key points

  • Applying display: flex to an element turns it into a flex container, and its direct children turn into flex items.

  • By default, using a flexbox produces elements of equal height.

  • You can set widths and margins on the items; even though this would add up to more than a 100%, the flexbox sorts it out.

  • use margin: auto to fill available space between the flex items.

Last updated