firefox推荐与个人理解的css书写顺序_ Div+Css教程-查字典教程网
firefox推荐与个人理解的css书写顺序
firefox推荐与个人理解的css书写顺序
发布时间:2016-12-29 来源:查字典编辑
摘要:最近的工作中,遇到不少问题,其中一个问题我觉得是最重要的,那就是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.其它

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

相关阅读
推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
  • 大家都在看
  • 小编推荐
  • 猜你喜欢
  • 最新 Div+Css教程学习
    热门 Div+Css教程学习
    网页设计子分类