CSS Flexbox Container Properties for Flexible Layouts


In CSS Flexbox, a "flex container" is an element that has been set to display: flex or display: inline-flex. Once an element is a flex container, you can use various properties to control the layout of its child elements (called "flex items"). Here are some of the most commonly used Flex container properties in CSS:

  • display: This property specifies the display behavior of an element. To use Flexbox, you need to set the display property to flex or inline-flex.
  • flex-direction: This property specifies the direction of the Flexbox layout. You can set it to row (horizontal), column (vertical), row-reverse, or column-reverse.
  • flex-wrap: This property specifies whether the Flexbox items should wrap or not. You can set it to nowrap (default), wrap, or wrap-reverse.
  • justify-content: This property specifies how the Flexbox items are distributed along the main axis. You can set it to flex-start, flex-end, center, space-between, space-around, or space-evenly.
  • align-items: This property specifies how the Flexbox items are aligned along the cross axis. You can set it to flex-start, flex-end, center, stretch, or baseline.
  • align-content: This property specifies how the Flexbox lines are aligned when there is extra space in the container. You can set it to flex-start, flex-end, center, space-between, space-around, or stretch.
  • flex-flow: This property is a shorthand for the flex-direction and flex-wrap properties. You can use it to set both properties at once, like this: flex-flow: row wrap;
  • gap: The gap property can be used on a Flex container to set both the row gap and column gap between its child Flex items.
  • row-gap: The row-gap property to set the gap between rows of Flex items.
  • column-gap: The column-gap property to set the gap between columns of Flex items.

These are just some of the most commonly used Flex container properties in CSS. By mastering these properties, you can create flexible and responsive layouts that adapt to different screen sizes and devices.

CSS Tutorial


Properties Reference


Cascading Style Sheet


Flexbox Tutorial


CSS Grid Tutorial


Transitions Properties


CSS Properties with Examples


CSS Selectors


CSS Pseudo Elements


CSS Attribute Selectors


Input Pseudo Classes


CSS Examples


CSS Animation Projects