The Web Developer Bootcamp 2024

Colt Steele

Back to Class Page


Flexbox

Flexbox & Responsive Web Design Course PDF

Flexbox is a one-dimensional layout method for arranging items in rows or columns. Items will expand to fill additional space, or shrink to fit into smaller spaces making it a flexible way of displaying content.


Why flexbox?
CSS flexible box layout enables you to:
  • Center a block of content inside its parent.
  • Make all the children of a container take up an equal amount of the available width/height, regardless of how much width/height is available.
  • Make all columns in a multiple-column layout adopt the same height even if they contain a different amount of content.

Flexbox consists of a parent container that is designated as a flex container, and the child elements that become the flex items.


Flex also works off of the premise of a MAIN and CROSS axis. These are determined by the flex designation, row or column, with row being the default.


Once you have designated a container as a flex container, AND determined which are the main and cross axises, you can then use flex properties to effect the layout of the content, within the flex container. Below is a partial list of some of these properties. Consult the documentation for more information.

Parent Properties:

Children/Flex-items Properties:


Back to Top