Fork me on GitHub

CSS Reset

针对前端设计,各个浏览器都有默认样式,这样造成的差异常常搞的我们很晕,而*{margin:0;padding:0}范围又太广,无法满足我们的需求,项目中常常存在reset.css的样式来统一默认样式。

淘宝的reset.css

 1 /** 清除内外边距 **/
 2 blockquote,body,button,dd,dl,dt,fieldset,form,h1,h2,h3,h4,h5,h6,hr,input,legend,li,ol,p,pre,td,textarea,th,ul {margin:0;padding:0}
 3 
 4 /** 设置默认字体 **/
 5 body,button,input,select,textarea {font:12px/1.5 tahoma,arial,'Hiragino Sans GB',\5b8b\4f53,sans-serif}
 6 h1,h2,h3,h4,h5,h6 {font-size:100%}
 7 
 8 /* 将斜体扶正 */
 9 address,cite,dfn,em,var {font-style:normal}
10 
11 /* 统一等宽字体 */
12 code,kbd,pre,samp {font-family:courier new,courier,monospace}
13 
14 /* 小于 12px 的中文很难阅读,让 small 正常化 */
15 small {font-size:12px}
16 
17 /** 重置列表元素 **/
18 ol,ul {list-style:none}
19 
20 a {text-decoration:none}
21 a:hover {text-decoration:underline}
22 sup {vertical-align:text-top}/*上标下标标签 重置,减少对行高的影响*/
23 sub {vertical-align:text-bottom}
24 /** 重置表单元素 **/
25 legend {color:#000}/* for ie6 */
26 fieldset,img {border:0} /* img 搭车:让链接里的 img 无边框 */
27 button,input,select,textarea {font-size:100%}/* 使得表单元素在 ie 下能继承字体大小 */
28 
29 /** 重置表格元素 **/
30 table {border-collapse:collapse;border-spacing:0}
View Code

大部分reset都这样,只是针对各个需求不一样,做少量增删。

 

posted @ 2014-12-29 21:38  Kingler  阅读(183)  评论(0编辑  收藏  举报