手机
当前位置:查字典教程网 >网页设计 > Div+Css教程 >firefox推荐与个人理解的css书写顺序
firefox推荐与个人理解的css书写顺序
摘要:最近的工作中,遇到不少问题,其中一个问题我觉得是最重要的,那就是css的书写顺序,他可以体现一个前端工作者的思续。如果您看到本文,请不要再想...

最近的工作中,遇到不少问题,其中一个问题我觉得是最重要的,那就是css的书写顺序,他可以体现一个前端工作者的思续。如果您看到本文,请不要再想到哪个属性就写哪个属性。

先来看一下firefox推荐的书写顺序

* mozilla.org Base Styles

* maintained by fantasai

* (classes defined in the Markup Guide -http://mozilla.org/contribute/writing/markup)

*/

/* Suggested order:

//显示属性

* 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

*

*/

从上面推荐的顺序可以看出,非常的有条理。上面推荐的顺序并没有把更加详细的属性写进去,比如:top,right,bottom,left等,也许有人会问,这样些对性能有什么影响吗?我非常遗憾的告诉你,我也不知道,但我想,有条理的做事才是正确的(也许你有更好的方法)。

我的理解:

1.显示属性:display||visibility||list-style(list-style-type、list-style-image、list-style-position)||overflow

2.定位及浮动属性:position||top||right||bottom||left||float||clear

3.盒模型:width||height||margin||padding||border

4.背景:background(background-image、background-position、background-repeat、background-attachment)

5.文字属性:font-style||font-variant||font-weight||font-size||font-family||color

6.文本属性:text-indent||text-align||vertical-align||letter-spacing||word-spacing||text-transform||text-decoration||text-shadow

7.其它

引用某位人的话,”不管你用不用这个顺序,反正我是用了”。欢迎大家指正

【firefox推荐与个人理解的css书写顺序】相关文章:

firefox中div+css的外层背景色不见的解决方法

css特效 一道闪光在图片上划过代码

firefox不显示border通过清除float便可解决

如何解决IE6/IE7不识别display:inline-block属性

CSS定义超链接四个状态的正确顺序L-V-H-A

最近在网页中常用的css和js酷炫动画效果

实现div垂直居中的display:table-cell方法示例介绍

5个CSS书写技巧

IE与Firefox的CSS兼容大全

CSS在IE与Firefox下的兼容性

精品推荐
分类导航