Skip to content

Latest commit

 

History

History
92 lines (55 loc) · 3.84 KB

flexbox.md

File metadata and controls

92 lines (55 loc) · 3.84 KB

CSS FlexBox

What is Flexbox?

⇢ Flexbox is a one-dimensional layout model. Before flexbox, there were four layout modes. The Flexbox provides a lot of flexibility.

It has two entities: ✧ flex-container ✧ flex-items CONTENT (11)

Example:

CONTENT (12)

Flex Container Properties

CONTENT (13)

Flex Item Properties

CONTENT (15)

display

⇢It is important to note that in order to use Flexbox properties, the display property must be set to "flex" or "inline-flex" on the parent container of the flex items. Without this, the Flexbox properties will not have any effect.

1. Container Properties

✧ flex-direction: row & row-reverse. CONTENT (17)

✧ flex-direction: column & column-reverse. CONTENT (18)

Flex Wrap

CONTENT (22)

flex-wrap

CONTENT (23)

There is another shorthand property, flex-flow, which allows setting both the flex-direction and flex-wrap properties in one line.

Example:

FoGrMCfaAAAAtwk

justify-content

CONTENT (26)

align-items

CONTENT (27)

align-content

CONTENT (28)

Flex items

order property

CONTENT (30)

Flex Items Properties

CONTENT (31)

Shorthand

The flex property is a shorthand for the flex-grow, flex-shrink, and flex-basis properties.

Example:

The element with the class "item2" will have a starting width of 100 pixels, and it will not grow or shrink in size relative to the other flex items in its container.

FoGrPKbacAEQB6R

align-self

The align-self property is similar to the align-items property that is used for Flex Containers, but it is applied to individual Flex Elements. It overrides the default alignment set by the align-items property.

It can take the following values: FoGrPljaYAQmP4C

Resources

That's all! For more read this blog post on Medium. All you need to learn about CSS FlexBox.