© Joe Attardi 2020
J. AttardiModern CSShttps://doi.org/10.1007/978-1-4842-6294-8_10

10. Flexbox

Joe Attardi1 
(1)
Billerica, MA, USA
 

The Flexible Box Layout Module, more commonly known as flexbox, is a powerful tool for building layouts with CSS. It is not quite as powerful as CSS Grid, which we’ll look at in Chapter 12, but it can solve many layout problems. Flexbox is a one-dimensional layout that can lay out elements either horizontally or vertically (but not both). An element using flexbox as its layout is referred to as a flex container , and the elements inside it are flex items .

Basic concepts

Let’s go over the basic concepts to understand flexbox.

Direction

A flex container has a direction , defined by the flex-direction property. It can be either ...

Get Modern CSS: Master the Key Concepts of CSS for Modern Web Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.