您的位置:首页 > Web前端 > CSS

CSS复位-CSS Reset代码举例

2013-12-10 09:52 155 查看
做为wefb前端设计人员,你用过CSS Rese(css样式重置)t吗?在实际工作中,你可能经常用到这行代码:

* { padding: 0; margin: 0; border: 0; }

这也是一款CSS Rese(css样式重置)t的方法,让所有的选择器的padding、margin和border都设置成0。这是一种强大的方法,也是最简单,最安全的方法,不过,也是最占用浏览器渲染的电脑资源

对于小型的网站来说,用这个并不会带来大的资源浪费,但如果是像Yahoo这种架构非常大的网站,则需要有选择地进行CSS重设,以减少资源浪费。

下面是Yahoo的CSS重设代码,也是受最多人喜爱的CSS Reset方法,可以被开发者复制重复利用代码:

body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,

form,fieldset,input,textarea,p,blockquote,th,td {

padding: 0;

margin: 0;

}

table {

border-collapse: collapse;

border-spacing: 0;

}

fieldset,img {

border: 0;

}

address,caption,cite,code,dfn,em,strong,th,var {

font-weight: normal;

font-style: normal;

}

ol,ul {

list-style: none;

}

caption,th {

text-align: left;

}

h1,h2,h3,h4,h5,h6 {

font-weight: normal;

font-size: 100%;

}

q:before,q:after {

content:”;

}

abbr,acronym { border: 0;

}文章来源:http://write.blog.csdn.net/postedit
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: