1. Box model
Standard box model:
- w=width+padding+border
- h=height+padding+border
Weird box model (ie box model)
- w=width contains (padding+border)
- h=height contains (padding+border)
2. CSS3 flexible box (key new version of flexible box)
Flexbox:
- After setting as a flexible box, the parent element is the container and the child element is the item
- There are two axes in the flex box, the default horizontal axis is the main axis, and the vertical axis is the side axis
- Items are arranged along the main axis by default
- Float, clear float, vertical-align are effective
Container properties (set for parent elements, affect child elements):
-
display: set to flexbox;
flex
inline-flex
-
flex-direction: Set the direction of the main axis
- row horizontal axis
- row-reverse reverse horizontal axis
- column vertical axis
- column-reverse reverse vertical axis
-
flex-wrap: whether to wrap
- nowrap: do not wrap, the default value
- wrap newline
- wrap-reverse reverse line break
-
Comprehensive writing method: flex-flow: Whether the direction of the main axis is changed;
-
justify-content: main axis alignment
- flex-start: starting position
- flex-end: end position
- center: center alignment
- space-around: bisect at both ends
- space-between: align both ends
- space-evenly: average distribution'
-
align-items: side axis alignment (single line, no line breaks)
- flex-strat: starting position
- center centered
- flex-end end position
- baselien text bottom alignment
-
align-content: side axis alignment (multiple lines, used when there is a line break)
- flex-start: starting position
- flex-end: end position
- center: center alignment
- space-around: bisect at both ends
- space-between: align both ends
- space-evenly: average distribution
Item properties (set for sub-elements, affect sub-elements):
-
align-self: side axis alignment
- flex-strat: starting position
- center centered
- flex-end: end position
- stretch
- auto default value, consistent with the align-items value of the parent element
-
order : reverse sort
The bigger the number, the further back, and vice versa, the more forward, it can be negative
-
flex: zoom size
- flex-grow: zoom in
- flex-shrink: shrink
- flex-basis: size
3. Multiple columns
Multi-column layout:
column-count: column
column-gap: column spacing
column-rule: column border size shape color (same as border)
column-fill : filling method
- balance: as evenly distributed as possible
- auto fills the previous column first
column-span: Whether to span columns
- none does not span columns
- all spans all columns
column-width: column width