CSS Flexible Box Layout (Flexbox)

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Introduction

The Flexible Box module, or just 'flexbox' for short, is a box model designed for user interfaces, and it allows users to align and distribute space among items in a container such that elements behave predictably when the page layout must accommodate different, unknown screen sizes. A flex container expands items to fill available space and shrinks them to prevent overflow.

Syntax

  • display: flex;
  • flex-direction: row | row-reverse | column | column-reverse;
  • flex-wrap: nowrap | wrap | wrap-reverse;
  • flex-flow: <'flex-direction'> || <'flex-wrap'>
  • justify-content: flex-start | flex-end | center | space-between | space-around;
  • align-items: flex-start | flex-end | center | baseline | stretch;
  • align-content: flex-start | flex-end | center | space-between | space-around | stretch;
  • order: <integer>;
  • flex-grow: <number>; /* default 0 */
  • flex-shrink: <number>; /* default 1 */
  • flex-basis: <length> | auto; /* default auto */
  • flex: none | [ <'flex-grow'> <'flex-shrink'>? || <'flex-basis'> ]
  • align-self: auto | flex-start | flex-end | center | baseline | stretch;

Remarks

Vender Prefixes

  • display: -webkit-box; /* Chrome <20 */
  • display: -webkit-flex; /* Chrome 20+ */
  • display: -moz-box; /* Firefox */
  • display: -ms-flexbox; /* IE */
  • display: flex; /* Modern browsers */

Resources



Got any CSS Question?