Skip to content

Instantly share code, notes, and snippets.

@gautam678
Created December 1, 2018 17:17
Show Gist options
  • Select an option

  • Save gautam678/43f4b923344749fc41254ce4c7788f0d to your computer and use it in GitHub Desktop.

Select an option

Save gautam678/43f4b923344749fc41254ce4c7788f0d to your computer and use it in GitHub Desktop.
Flexbox

Flexbox

Justify-content:

  • flex-start: Items align to the left side of the container.
  • flex-end: Items align to the right side of the container.
  • center: Items align at the center of the container.
  • space-between: Items display with equal spacing between them.
  • space-around: Items display with equal spacing around them.

Align-items:

This CSS property aligns items vertically and accepts the following values:

  • flex-start: Items align to the top of the container.
  • flex-end: Items align to the bottom of the container.
  • center: Items align at the vertical center of the container.
  • baseline: Items display at the baseline of the container.
  • stretch: Items are stretched to fit the container.

Flex-Direction:

This CSS property defines the direction items are placed in the container, and accepts the following values:

  • row: Items are placed the same as the text direction.
  • row-reverse: Items are placed opposite to the text direction.
  • column: Items are placed top to bottom.
  • column-reverse: Items are placed bottom to top.

Order:

items have a value of 0, but we can use this property to set it to a positive or negative integer value.

Flex-wrap:

Spread elements using the flex-wrap property, which accepts the following values:

  • nowrap: Every item is fit to a single line.
  • wrap: Items wrap around to additional lines.
  • wrap-reverse: Items wrap around to additional lines in reverse.

Note:

The two properties flex-direction and flex-wrap are used so often together that the shorthand property flex-flow was created to combine them. This shorthand property accepts the value of one of the two properties separated by a space.

align-content:

Set how multiple lines are spaced apart from each other. This property takes the following values:

  • flex-start: Lines are packed at the top of the container.
  • flex-end: Lines are packed at the bottom of the container.
  • center: Lines are packed at the vertical center of the container.
  • space-between: Lines display with equal spacing between them.
  • space-around: Lines display with equal spacing around them.
  • stretch: Lines are stretched to fit the container.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment