【27前端】CSS Reset

CSS reset就像是一种宁可错杀三千不可放过一个的做法。

 

一个最简单粗暴的css reset解决方案 *{ margin:0; padding:0; }

多余的话我就不再累赘,想要更多可以参考我的技术男神张鑫旭的文章CSS reset的重新审视 – 避免样式重置

下面是我总结的一些基础css reset 供大家参考。我觉得每个网站都应该有自己单独的一套css reset。

 1 ul, ol, fieldset{ margin: 0; padding: 0; }
 2 th, td, legend{ padding:0; }
 3 body,h1, h2, h3, h4, h5, h6, p, dl,dd,form,textarea { margin:0; }
 4 
 5 /*隐藏横向滚动,垂直滚动根据内容自适应(去除IE默认垂直滚动条)*/   
 6 html { overflow-x: hidden; overflow-y: auto; }
 7 
 8 /* 重置列表元素 */
 9 li { list-style: none; }
10 
11 /*去掉下滑线*/  
12 a { text-decoration: none; }
13 /*:link, :visited { text-decoration: none; } 真正有下划线样式的其实只有 :link和:visited*/
14 a, button{ cursor:pointer; }
15 
16 /* 去掉边框 IE8-要在ifarme标签上添加属性 frameborder="0" 才能去掉边框 */
17 fieldset, img ,iframe { border: 0; } 
18 
19 /*去除字体默认样式*/
20 i,em,dfn,var,cite,address,optgroup{ font-style:normal; }
21 strong,th{ font-weight:normal; }
22 small,button, input, select, textarea{ font-size:100%; }
23 
24 //code,pre,samp,kbd{ font-size:100%; }
25 hr{ margin:0; border:1px solid; border-width:1px 0 0 ; height:0; clear:both;  }
26 
27 /*继承父级元素的字体大小,粗体还原*/
28 h1, h2, h3, h4, h5, h6{ font-size:100%; font-weight:normal; } 
29 
30 /* 让表格边框可以为1 */
31 table { border-collapse: collapse; border-spacing: 0; } 
32 caption, th { text-align: left; } 
33 
34 button, input, select { vertical-align: middle; }
35 textarea{ vertical-align: top; }

 

posted on 2016-05-09 14:07  ziven27  阅读(150)  评论(0编辑  收藏  举报

导航