CSS_代码规范_书写顺序

52CSS中有提到团队协作与代码规范的内容,如下:

 

一、显示属性

div css xhtml xml Example Source Code Example Source Code [www.52css.com]
* display
* list-style
* position
* float
* clear 

  二、自身属性

div css xhtml xml Example Source Code Example Source Code [www.52css.com]
* width
* height
* margin
* padding
* border
* background 

三、文本属性

div css xhtml xml Example Source Code Example Source Code [www.52css.com]
* color
* font
* text-decoration
* text-align
* vertical-align
* white-space
* other text
* content
我个人的书写习惯与之相似,略有不同的是:
1.我更倾向于在第一部分中书写与整体布局有关,与其它元素位置相关的内容 如:margin,padding;
2.整体完了再写自身,如:width,height,background;
3.最后文本:color,font,text-align...
大概格式如下: