CSS Flexible Box Layout

CSS Flexible Box Layout, commonly known as Flexbox, is a CSS 3 web layout model. It is in the W3C's candidate recommendation (CR) stage. The flex layout allows responsive elements within a container to be automatically arranged depending upon screen size (or device).
Concepts.
Most web pages are written in a combination of HTML (Hypertext Markup Language) and CSS (Cascading Style Sheets). In short, HTML specifies the "content and logical structure of the page", while the CSS specifies "how it looks": its colors, fonts, formatting, layout, and styling.
CSS flex-box layout is a particular way to specify the layout of HTML pages.
One of the most defining features of the flex layout is its ability to form-fit, based on its viewing environment. Flex boxes can adjust in size—either decreasing, to avoid unnecessarily monopolizing space, or increasing to make room for contents to be constrained within its boundaries. Moreover, the flex layout is less restrictive in terms of content flow than those, for example, of the block and inline display types, which are generally uni-directional. The flex directional flow can be specified as rightwards, leftwards, upwards, or downwards. Individual items within a flex container may also be automatically reordered and rearranged to suit the available layout space.
History.
In the 2000s the intensive use of the Web by mobile agents motivated "liquid layouts" and responsive elements for the growing variety of screen sizes. 
In the 2010s, the intensive use of popular JavaScript layout frameworks, such as Bootstrap, inspired CSS flex-box and grid layout specifications.
CSS 3 modules included solutions akin to this, like flexbox and grid.
, 98.69% of installed browsers (99.29% of desktop browsers and 100% of mobile browsers) support CSS Flexible Box Layout.
Terminology.
The following terms are associated with the flexbox layout model.
Usage.
Designating an element as a flex element requires setting the element's CSS display property to either flex or inline-flex, as follows:
display: flex;
Or:
display: inline-flex;
By setting the display to one of the two values above, an element becomes a flex container and its children flex items. Setting the display to flex makes the container a block-level element, while setting the display to inline-flex makes the container an inline-level element.
Align to center.
One of flexbox's advantages is the ability to easily align items within the container to the center of a page, both vertically and horizontally.
display: flex;
align-items: center;
justify-content: center;