我比较喜欢的reset css
各浏览器的默认样式都并不太一致,所以我们得建立一个reset.css,使各浏览器对各元素的默认属性都一致。reset css这大家都见得多了,对常用的莫过
*{margin:0;padding:0}YUI的reset
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td {
margin:0;
padding:0;
}
table {
border-collapse:collapse;
border-spacing:0;
}
fieldset,img {
border:0;
}
address,caption,cite,code,dfn,em,strong,th,var {
font-style:normal;
font-weight:normal;
}
ol,ul {
list-style:none;
}
caption,th {
text-align:left;
}
h1,h2,h3,h4,h5,h6 {
font-size:100%;
font-weight:normal;
}
q:before,q:after {
content:'';
}
abbr,acronym {
border:0;
}
这些reset没有最佳的,只有最适合自己项目的。
动手来做我喜欢的reset css,而且也简单的。首先重置你的margin和pading
html, body, div, blockquote, img, label, p, h1, h2, h3, h4, h5, h6, pre, ul,
ol, li, dl, dt, dd, form, fieldset, input, th, td, a{
margin: 0;
padding: 0;
border: 0;
outline: none;
list-style: none;
}
重置标题字体大小为100%
h1,h2,h3,h4,h5,h6{
font-size:100%;
}
设置文字大小100%的基数。
body{
line-height: 1;
font-size: 88%;
}
一般浏览器默认文字大小是1em,大约是16px,那body文字大小88%后,大约14px,所以h系列的大小也在14px左右。如果想给文字设置为12px,那么p{font-size:90%}。
最终重置css
html{/* for firefox */
overflow:-moz-scrollbars-vertical;
overflow-x:auto;
}
html, body, div, blockquote, img, label, p, h1, h2, h3, h4, h5, h6, pre, ul,
ol, li, dl, dt, dd, form, fieldset, input, th, td, a{
margin: 0;
padding: 0;
border: 0;
outline: none;
list-style: none;
}
body{
line-height: 1;
font-size: 88%;
}
h1,h2,h3,h4,h5,h6{
font-size:100%;
}
我这里没有设置字体,具体参照 web 安全字体 吧。上面这些元素是最常用的,但现在用的比较多的有sup、sub、cite等,也可以考虑重置为无表现样式。
扩展阅读:http://meyerweb.com/eric/thoughts/2007/05/01/reset-reloaded/





