Home > Web Front-end > HTML Tutorial > 【27前端】CSS Reset_html/css_WEB-ITnose

【27前端】CSS Reset_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:18:35
Original
1036 people have browsed it

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; }
Copy after login

 

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template