1. CSS Reset为何存在?css
只要您的客户存在使用不一样浏览器(ie,firefox,chrome等)的可能,那你就不得不从完美的理想状态回到现实,由于不一样核心的浏览器对CSS的解析效果呈现各异,致使您所指望的效果跟浏览器的“理解”效果有误差,今天提到的css reset就是用来重置(复位)元素在不一样核心浏览器下的默认值,尽可能保证元素在不一样浏览器下的同一“起跑线”。前端
——引用自关于CSS Resetweb
2. CSS Reset该怎么写?chrome
CSS reset(css重置)基本上是不须要的,至少能够说80%的的CSS reset都是没有必要的,反而增长了页面CSS浏览器
的重写,尤为像*{margin:0;}的作法更是要不得(反而破坏了不少UI的兼容性,好比说单复选框等)。我不是一律鄙弃CSS架构
reset,有些经常使用标签我也是会简单重置一下的,并且会避免overwrite(样式重写),以保证样式最精简,渲染最高效app
——摘录自张鑫旭的这篇文章我是如何对网站CSS进行架构的学习
3. CSS Reset 示例网站
3.1 tmall,淘宝商城spa
body,h1,h2,h3,h4,h5,h6,hr,p,blockquote,dl,dt,dd,ul,ol,li,pre, form,fieldset,legend,button,input,textarea,th,td {margin:0;padding:0;} body,button,input,select,textarea{font:12px/1.5 tahoma,arial,\5b8b\4f53;} h1,h2,h3,h4,h5,h6{font-size:100%;} address,cite,dfn,em,var{font-style:normal;} code,kbd,pre,samp{font-family:courier new,courier,monospace;} small{font-size:12px; ul,ol{list-style:none;} a{text-decoration:none;} a:hover{text-decoration:underline;} sup{vertical-align:text-top;} sub{vertical-align:text-bottom;} legend{color:#000;} et,img{border:0;} button,input,select,textarea{font-size:100%;} table{border-collapse:collapse;border-spacing:0;}
3.2 tudou,土豆网
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} body{color:#000;background:#fff;font-size:12px;line- height:1.25;font-family:tahoma,arial,\5b8b\4f53,sans-serif} th,td{text-align:left;vertical-align:top} h1,h2,h3,h4,h5,h6{font-size:1em;font-weight:normal} p{margin:0 0 1em 0} blockquote{margin:0 0 1em 0 a{color:#14647d;text-decoration:none;font-family:tahoma,arial,\5b8b\4f53,sans-serif;_font-family:arial,sans-serif} a:hover{text-decoration:underline} img{display:block;border:0} li{list-style:none} ol{padding:0 0 0 2em} input,label,select,option,textarea,button,fieldset,legend{font-size:1em;font-family:tahoma,arial,\5b8b\4f53,sans-serif;_font-family:Arial,sans-serif} input[type=text],textarea{-webkit-appearance:none;-webkit-border-radius:0;outline:none} input.text{color:#444;border-color:#9f9f9f #dcdcdc #dcdcdc #9f9f9f;border-style:solid;border-width:1px;padding:3px 2px;height:14px} input.radio,input.checkbox{margin-right:2px;vertical-align:-2px} input.radio,input.checkbox{margin-left:-2px} label.radio,label.checkbox{margin-right:5px}
3.3 sohu,搜狐网
/* 全局CSS定义 */ body{font-family:’宋体';text-align:center;margin:0 auto;padding:0;background:#FFF;font-size:12px;color:#333;} body > div{text-align:center;margin-right:auto;margin-left:auto; div,form,ul,ol,li,span,p{margin:0;padding:0;border:0;} img,a img{border:0;margin:0;padding:0;} h1,h2,h3,h4,h5,h6{margin:0;padding:0;font-size:12px;font-weight:normal; ul,ol,li{list-style:none} table,td,input{font-size:12px;padding:0} /* 默认连接颜色 */ a{outline-style:none;color:#333;text-decoration:none} a:hover{color:#c00;text-decoration:underline;}
相信不少人在刚接触前端或者中期时候总会遇到一些问题及瓶颈期,如学了一段时间没有方向感或者坚持不下去一我的学习枯燥乏味有问题也不知道怎么解决,对此我整理了一些资料 喜欢个人文章想与更多资深大牛一块儿讨论和学习的话 欢迎加入个人学习交流群907694362