标题css属性书写顺序
-
布局定位属性: display/position/float/clear/visibility/overflow
6个 -
自身属性: width/height/margin/padding/border/background
6个 -
文本属性:color/font/text-decoration/text-align/vertical-align/white-space/break-word
7个 -
其他属性(css3): content/cursor/border-radius/box-shadow/text-shadow/background:linear-gradient…
.sidebar {
/* formatting model: positioning schemes / offsets / z-indexes / display / ... */
position: absolute;
top: 50px;
left: 0;
overflow-x: hidden;
/* box model: sizes / margins / paddings / borders / ... */
width: 200px;
padding: 5px;
border: 1px solid #ddd;
/* typographic: font / aligns / text styles / ... */
font-size: 14px;
line-height: 20px;
/* visual: colors / shadows / gradients / ... */
background: #f5f5f5;
color: #333;
-webkit-transition: color 1s;
-moz-transition: color 1s;
transition: color 1s;
}
参考
CSS属性书写顺序|css编码规范
最近看到的另一个非常不错的前端编码规范文档,必须强烈推荐:
前端代码规范@mdo