flex property description

1. Related properties of flex layout container side

  • flex-direction direction
flex-direction illustrate Effect Defaults
row Horizontal orientation (left => right) insert image description here yes
row-reverse Horizontal orientation (right => left) insert image description here
column vertical direction (up => down) insert image description here
column-reverse Vertical direction (down => up) insert image description here
  • flex-wrap line break
flex-wrap illustrate Effect Defaults
nowrap no line break insert image description here yes
wrap Newline (on) insert image description here
wrap-reverse Newline (below) insert image description here
  • flex-flow is shorthand for flex-direction and flex-wrap
flex-flow: row nowarp;
  • justify-content horizontal alignment
justify-content illustrate Effect Defaults
flex-start align left insert image description here yes
flex-end right align insert image description here
center center alignment insert image description here
space-between justify insert image description here
space-around interval insert image description here
  • align-items vertical alignment
align-items illustrate Effect Defaults
flex-start top alignment insert image description here
flex-end Bottom alignment insert image description here
center center alignment insert image description here
stretch full height insert image description here yes
baseline baseline insert image description here
  • align-content The alignment of multiple axes. This property has no effect if the item has only one axis.
align-content illustrate Effect Defaults
flex-start start alignment insert image description here
flex-end end alignment insert image description here
center center alignment insert image description here
stretch full alignment insert image description here yes
space-between justify insert image description here
space-around spaced alignment insert image description here

Two, child element attributes

  • order Sort order. The smaller the value, the higher the arrangement, the default is 0
    insert image description here

  • flex-grow enlargement ratio, the default is 0, that is, if there is remaining space, it will not be enlarged.
    insert image description here

  • flex-shrink reduction ratio, the default is 1, that is, if there is insufficient space, the item will shrink.
    insert image description here

  • flex-basis The amount of space an item occupies in the main axis before allocating excess space

  • flex is shorthand for flex-grow, flex-shrink and flex-basis, the default value is 0 1 auto. The last two attributes are optional.

  • align-self allows a single item to have a different alignment than other items, which can override the align-items property. The default value is auto

Guess you like

Origin blog.csdn.net/weixin_39423672/article/details/121783291