CSS縮寫屬性整理
border
- border-width
- border-style
- border-color
順序任意,除了border-style必須設置外,其餘值可以省略爲默認值。只能設置全局邊框,可以用border-top、border-left等簡寫屬性來覆蓋修改局部
background
以下屬性可採用任何順序,且都是可選屬性:
- background-color
- background-position
- background-size
- background-repeat
background-origin
- content-box(默認)
- border-box(設置width和height時包含內邊距和邊框)
- background-clip
- background-attachment
background-image
(順便說一句,background-size設置百分數時,第一個數相對於父元素的width,第二個相對於父元素的height,如果只設置一個,第二個爲auto)font
- font-style
- font-width
font-variant
- small-caps (小型大寫字母)
- normal
- font-size
font-family
前三個值的順序隨意且可缺省,但是後兩個值必須有且必須是font-size在前,font-family在後的順序
font-size後加斜槓(/)可以添加line-height屬性