css 속성 순서 - 타입에 의한 분류법
2022. 5. 4. 12:31ㆍ카테고리 없음
https://shylog.com/how-do-you-order-your-CSS-properties/
Ordering rules
- Position
- Layout
- Display
- Visibility
- Box model
- Color
- Text
- Animation
- Others
- Pseudo elements
Positioning
- position
- z-index
- top
- bottom
- left
- right
- trasnform
Layout
- float
- clear
Display
- display
- flex-direction
- flex-wrap
- justify-content
- align-content
- align-items
- order
- flex-grow
- flex-shrink
- flex-basis
- align-self
Visibility
- visibility
- overflow
- clip
Box model
이 범주에 속하는 속성들은 밖에서 안으로 향하는 순서(From outside in)로 나열한다. 원래대로라면 border 속성도 Box model 범주에 포함시켜야하겠지만, border 영역은 두께만 단독으로 선언하지 않고 색상(Color)을 함께 선언하는 경우가 대부분이므로 Color 범주로 포함시킨다.
- box-sizing
- width
- min-width
- max-width
- height
- min-height
- max-height
- margin
- padding
Color
- color
- border
- border-radius
- background
- box-shadow
- opacity
Text
- font
- font-family
- font-size
- font-weight
- font-style
- font-variant
- font-size-adjust
- font-stretch
- font-effect
- font-emphasize
- font-emphasize-position
- font-emphasize-style
- font-smooth
- line-height
- letter-spacing
- white-space
- word-break
- text-overflow
Animation
- transition
- animation
Others
- cursor
- outline
- outline-width
- outline-style
- outline-color
- outline-offset
Pseudo elements
- :hover
- :focus
- :active
- :first-child
- :last-child
- ::before
- ::after