【规范】css
声明顺序
为了保证更好的可读性,我们应该遵循以下顺序:
- 定位:
position
|z-index
|top
|right
|bottom
|left
|clip
- 布局:
display
|float
|clear
|visibility
|overflow
|overflow-x
|overflow-y
- 尺寸:
width
|min-width
|max-width
|height
|min-height
|max-height
- 外边距:
margin
|margin-top
|margin-right
|margin-bottom
|margin-left
- 内边距:
padding
|padding-top
|padding-right
|padding-bottom
|padding-left
- 边框:
border
|border-top
|border-right
|border-bottom
|border-left
|border-radius
|box-shadow
|border-image
- 背景:
background
|background-color
|background-image
|background-repeat
|background-attachment
|background-position
|background-origin
|background-clip
|background-size
- 颜色:
color
|opacity
- 字体:
font
|font-style
|font-variant
|font-weight
|font-size
|font-family
- 文本:
text-transform
|white-space
|word-break
|word-wrap
|overflow-wrap
|text-align
|word-spacing
|letter-spacing
|text-indent
|vertical-align
|line-height
- 文本修饰:
text-decoration
|text-shadow
- 书写模式:
direction
|unicode-bidi
|writing-mode
- 列表:
list-style
|list-style-image
|list-style-position
|list-style-type
- 表格:
table-layout
|border-collapse
|border-spacing
|caption-side
|empty-cells
- 内容:
content
|counter-increment
|counter-reset
|quotes
- 用户界面:
appearance
|text-overflow
|outline
|outline-width
|outline-color
|outline-style
|outline-offset
|cursor
|zoom
|box-sizing
|resize
|user-select
- 多列:
columns
|column-width
|column-count
|column-gap
|column-rule
|column-rule-width
|column-rule-style
|column-rule-color
|column-span
|column-fill
|column-break-before
|column-break-after
|column-break-inside
- 伸缩盒:
flex
- 变换,过渡,动画:
transform
|transition
|animation