CSS属性书写顺序

css属性顺序是css良好编码风格的一部分,有助于提高代码可读性,便于发现代码问题,有利于团队合作。

建议遵循:布局定位属性 自身属性 文字样式 文本属性 其他属性 CSS3属性(下列列出常用的属性,并非全部)

属性类型 属性
布局定位属性 display / list-style / position (相应的 top,right,bottom,left) / float / clear / visibility / overflow
自身属性 width / height / margin / padding / border / background
文字样式 font-family / font-size / font-style / font-weight / font-varient / color
文本属性 text-decoration / text-align / vertical-align / white-space / break-word
其他(CSS3) content / cursor / border-radius / box-shadow / text-shadow / background:linear-gradient ...