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

css reset 整理

2016-01-05 15:54 686 查看
什么叫做css reset呢?即重置css,也就是重置默认样式。一些标签元素在HTML下有一个默认属性值,我们在写css页面的时候,为了避免在css中重复定义它们,我们需要重置默认样式(css reset)。

以前使用最多*{margin:0;padding:0},但其格式化太严重,慢慢被废弃。

国内大型门户如QQ,taobao等css reset时均有yui的影子。

业内用的最多的还有Erik Meyer’s CSS Reset

个人认为:应根据需求,量体裁衣。

综合yui,Erik,taobao我们就可以写出了自己的css reset。

参考文章:

1。Reset CSS 研究(技术篇)

2。Reset CSS研究(八卦篇)

3。Erik Meyer’s CSS Reset

4。YUI css reset

整理的css reset:

/* reset */

html{color:#000;background:#fff;}

body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,input,button,textarea,p,blockquote,th,td{margin:0;padding:0;}

body{font:12px/1 Tahoma,Helvetica,Arial,"\5b8b\4f53",sans-serif;}

img{border:none;}

em,strong{font-style:normal;font-weight:normal;}

li{list-style:none;}

table {border-collapse:collapse;border-spacing:0;}

h1{font-size:18px;}

h2{font-size:16px;}

h3{font-size:14px;}

h4, h5, h6{font-size:100%;}

q:before,q:after{content:'';}/* 消除q前后的内容 */

button,input,select,textarea{font-size:100%;}/* 使得表单元素在 ie 下能继承字体大小 */

input,button,textarea,select,optgroup,option{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;}

address,cite,dfn,em,var{font-style:normal;} /* 将斜体扶正 */

/* link */

a{color:#36c;text-decoration:none;}

a:hover{color:#f60;text-decoration:underline;}

复制代码
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: