user agent stylesheet瀏覽器默認樣式及樣式重置

1、user agent stylesheet是瀏覽器默認樣式表,是瀏覽器默認樣式。

2、不同瀏覽器的默認樣式不同個,甚至同種瀏覽器不同版本的默認樣式也可能不同。其中google中對body的默認樣式爲margin:8px;


3、前端開發者在開發網頁的時候如果考慮適配不同瀏覽器的不同默認樣式,一般是採用重置瀏覽器的默認樣式

例如:

html{height:100%; width:100%;}
a{text-decoration:none;}
li{list-style:none;}

4、收集的PC端重置樣式

@charset "utf-8";

/* CSS Document */
* { color:#444; }
body { font:12px/1.5 "微軟雅黑",Arial,Tahoma, Helvetica,\5b8b\4f53, sans-serif; }
html,body,div,h1,h2,h3,h4,h5,h6,hr,p,blockquote,dl,dt,dd,ul,ol,li,pre,form,fieldset,object,code,em,span,var,legend,button,input,textarea,th,td,a,img,header,footer,nav,aside,audio,datalist,section { margin:0;padding:0;border:0;outline:0; }/*清除內外邊距*/
h1,h2,h3,h4,h5,h6 { font-weight:normal;font-size:100%; }/*設置默認字體*/
:focus { outline:0; }
ul,ol,ul li,ol li { list-style: none; }/*重置列表*/
address,caption,cite,em,code,dfn,th,var { font-style:normal;font-weight:normal; }
form label { cursor:pointer; }
input,button,select,textarea { font-family:inherit;font-size:100%;outline:none; }
textarea { resize:none }
input { vertical-align:middle; }
img { border:0; }/*重置圖片元素*/
table { border-collapse:collapse;border-spacing: 0; }/*重置表格*/
.l { float:left; }
.r { float:right; }
button,input[type="reset"],input[type="button"],input[type="submit"] { line-height:normal !important; }
a { text-decoration:none;}
a { color:#666;}
a:hover { text-decoration:underline; }
input { _filter:chroma(color=#000000); }
/*--清除浮動
------------------------------------------------------------------------------------------*/
.clearfix:after { clear:both;content:".";display:block;font-size:0;height:0;visibility:hidden; }
.clearfix:after { _zoom:1; }
.overflow { overflow:hidden; _zoom:1; }
.clear { clear:both; height:0;font-size:0; overflow:hidden; }

5、移動端重置樣式reset.css

@charset "utf-8";
/* @group Public */
body,div,ul,ol,dl,li,dt,dd,h1,h2,h3,h4,p,form,iframe,input,textarea,a,span,em,strong,img,html,nav,header,article,button,footer,var {padding:0;margin:0;}
body { font:12px/1.2rem "Microsoft YaHei",tahoma,arial,sans-serif;min-width:320px;position:relative; }
form,input {background:none;border:none;}
ul,dl,ol {list-style-type:none;}
h1, h2, h3, h4, h5 { font:12px/1.2rem "Microsoft YaHei",arial,tahoma; }
a { text-decoration:none; }
a:hover,a:focus { outline:none; }
table { border-collapse:collapse;border-spacing:0; }
img { border:none; }
strong,b { font-weight:normal; }
em,i,var { font-style:normal; }
p { text-indent:0; }
.clear { clear:both;height:0;line-height:0;overflow:hidden;width:0; }
.clearfix:after { clear:both;content:".";display:block;font-size:0;height:0;visibility:hidden; }


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章