Mastering layout
Flex
1 | .site-nav > li + li{ |
- property
- justify-content(horizonal)
- align-items(vertical)
- align-content(wrap)
- align-self
- flexbugs
- autoprefixer
- automatiealy creates column of equal height
Grid
property
- grid line
- grid track
- grid cell
- grid area
naming grid line
naming grid area
auto
- grid-auto-rows
- auto-fill
- auto-fit
- object-fit (image)
1 | .container{ |
position and stacking contexts
- not positioned
- static
- positioned
- fixed
- viewport
- Tip:use it for modal dialogs
- absolute
- the closest positioned ancenstor element
- Tip: dropdown menus,tooltips,dynamic interactions
- relative
- relative to where they where
- unlike fixed and absulte,you can’t use top,right,bottom,left to change size
- tip:It is usually used to set absolute container as relative
- sticky
- scroll normal untill reach some place
- remember parent must be higher than sticky element
- tip: is surpported
- fixed
- css triangle
- stacking order
- z-index
- can’t over ancenstor order
- careful use,or by custom properties
- z-index