前端开发中觉得有必要规范CSS书写顺序

在网上找一段Mozilla Firefox 建议的CSS书写顺序;

 把CSS常用样式分为三类

//显示属性
display  list-style position  float clear 
//自身属性
width height  margin  padding border  background
//文本属性
color font  text-decoration text-align  vertical-align  white-space other text  content

 

 CSS森林 中找到一篇好文

文章地址:http://www.cssforest.org/blog/index.php?id=38 

整理了一下自己写CSS时的顺序,跟大家分享下。

下表顺序为从上到下,从左到右:
========================
display || visibility
list-style : list-style-type || list-style-position || list-style-image
position
top || right || bottom || left
z-index
clear
float

width
max-width || min-width
height
max-height || min-height
overflow || clip
margin : margin-top || margin-right || margin-bottom || margin-left
padding : padding-top || padding-right || padding-bottom || padding-left
outline : outline-color || outline-style || outline-width
border
background : background-color || background-image || background-repeat || background-attachment || background-position

color
font : font-style || font-variant || font-weight || font-size || line-height || font-family
font : caption | icon | menu | message-box | small-caption | status-bar
text-overflow
text-align
text-indent
line-height
white-space
vertical-align
cursor
========================

文章地址:http://www.cssforest.org/blog/index.php?id=38

[原]CSS书写顺序》采用的授权是创作共用的 “署名-非商业性使用-相同方式共享 3.0 通用许可”.

 

 

posted @ 2011-05-31 11:07  qdsang  阅读(369)  评论(3编辑  收藏  举报