06 Flexbox Cheatsheet

06 Flexbox Cheatsheet

Flexbox

Flexbox is used to structure needed for website content. used in designing responsive layouts.

image_01.png

image_02.png

Flex property value (display:flex)

In Flex box we have two things to understand one is parent which holds the flex items and the flex items are child. parent is nothing but the container class. and the child is nothing but the items class.

display property is assigned with the value flex should be given to parent/container class

display : flex

Justify Content as Main Axis (flex-direction : row as default)

01_flex_start.png

02_flex_end.png

03_center.png

04_space_around.png

05_space_between.png

06_space_evenly.png

Justify Content as Main Axis (flex-direction : column as default)

01_flex_start_cross.png

02_flex_end_cross.png

03_center_cross.png

04_space_around_cross.png

05_space_between_cross.png

06_space_evenly_cross.png

Align-items as Cross-axis (Flex-direction : row)

flex-start.png

flex-end.png

center.png

baseline.png

stretch.png

flex-start_cross.png

flex-end_cross.png

center_cross.png

baseline_cross.png

stretch_cross.png

flex-direction property

This property allows us to set the direction and orientation of our flex-items inside the flex parent container how its should be arranged.

row.png

row-reverse.png

column.png

column-reverse.png

##flex-wrap Wraps the items inside the container. if wrap happens we can arrange the whole content using align-content.

flex-wrap: wrap;

align-content property

This property distributed the flex-items along the CROSS AXIS inside the parent container.

flex-start.png

flex-end.png

center.png

space-around.png

space-between.png

stretch.png

Align Self

This property works on the child classes.

flex-start.png

flex-end.png

center.png

stretch.png

baseline.png

flex-grow

Flex item grows based on the value given value denotes a part of the total width.

flex-grow.png

flex-shrink

Flex item shrinks based on the value given value denotes a part of the total width.

flex-shrink.png

Flex wrap

Wraps the content to next line if its not set it will align the contents in linear order.

flex-no-wrap.png

flex-wrap.png

Flex Basis

Set width of the flex-item but it may vary based on flex-grow,flex-shrink in some cases

flex-basis.png

Flexbox shorthand

flex:

flex is shorthand for flex-grow,flex-shrink and flex-basis

flex : 1 2 24rem;
  • first value is flex-grow
  • second value is flex-shrink
  • third value is flex-basis

flex-flow

flex-flow is shorthand for flex-direction and flex-wrap

flex-flow : row wrap;
  • first value is flex-direction
  • second value is flex-wrap

place-content:

place-content : center flex-start;
  • first value is for align-content
  • second value is for justify-content

Conclusion

Practice Practice Practice you will be clear.