书写高效CSS注意的七个方面
时间:2010-02-05 09:58:37 来源: 评论: 点击:加载中...
随着CSS网页布局的应用越来越广泛,更多的CSSer开始书写CSS,如何才能写出高效规范的CSS代码呢,今天向大家介绍,必须要注意的七个方面:一...
body { font-size: 85%; font-family: arial, helvetica, sans-serif; background-image: url(image.gif); background-repeat: no-repeat; background-position: 0 100%; margin-top: 1em; margin-right: 1em; margin-bottom: 0; margin-left: 1em; padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px; border-style: solid; border-width: 1px; border-color: red; color: #222222; 高效的
CSS代码
- body { font: 85% arial, helvetica, sans-serif; background: url(image.gif) no-repeat 0 100%; margin: 1em 1em 0; padding: 10px; border: 1px solid red; color: #222; }
七、避免使用 !important
慎用写法
CSS代码
- #news { background: #ddd !important; }
特定情况下可以使用以下方式提高权重级别
CSS代码
- #container #news { background: #ddd; }
- body #container #news { background: #ddd; }
5/5 首页 上一页 3 4 5