好程序員web前端分享css初始化代碼

 好程序員web前端分享css初始化代碼,CSS初始化是指重設瀏覽器的樣式。不一樣的瀏覽器默認的樣式可能不盡相同,css

 

因此開發時的第一件事可能就是如何把它們統一。html

 

若是沒對CSS初始化每每會出現瀏覽器之間的頁面差別。前端

 

每次新開發網站或新網頁時候經過初始化CSS樣式的屬性,程序員

 

爲咱們將用到的CSS或html標籤更加方便準確,web

 

使得咱們開發網頁內容時更加方便簡潔,瀏覽器

 

同時減小css代碼量,節約網頁下載時間。字體

 

 

 

/*css reset code */網站

 

 

/**** 文字大小初始化,使1em=10px *****/spa

 

 

body {code

 

font-size:62.5%;

 

 

} /* for IE/Win */

 

 

html>body {

 

 

font-size:10px;

 

 

} /* for everything else */

 

 

/*字體邊框等初始化*/

 

 

body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td {

 

 

padding: 0;

 

 

margin: 0;

 

 

}

 

 

table {

 

 

border-collapse: collapse;

 

 

border-spacing: 0;

 

 

}

 

 

fieldset,img {

 

 

border: 0;

 

 

}

 

 

img {

 

 

display:block;

 

 

}

 

 

address,caption,cite,code,dfn,th,var {

 

 

font-weight: normal;

 

 

font-style: normal;

 

 

}

 

 

ol,ul {

 

 

list-style: none;

 

 

}

 

 

caption,th {

 

 

text-align: left;

 

 

}

 

 

h1,h2,h3,h4,h5,h6 {

 

 

font-weight: normal;

 

 

font-size: 100%;

 

 

}

 

 

q:before,q:after {

 

 

content:'';

 

 

}

 

 

abbr,acronym { border: 0;

 

 

}

 

 

a {

 

 

text-decoration:none;

 

 

}

 

 

body,ol,ul,h1,h2,h3,h4,h5,h6,p,th,td,dl,dd,form,fieldset,legend,input,textarea,select{margin:0;padding:0}

 

 

body{font:12px"宋體","Arial Narrow",HELVETICA;background:#fff;-webkit-text-size-adjust:100%;}

 

    a{color:#2d374b;text-decoration:none}

 

a:hover{color:#cd0200;text-decoration:underline}

 

em{font-style:normal}

 

li{list-style:none}

 

img{border:0;vertical-align:middle}

 

table{border-collapse:collapse;border-spacing:0}

 

p{word-wrap:break-word}

 

body,ul,ol,li,p,h1,h2,h3,h4,h5,h6,form,fieldset,table,td,img,div{margin:0;padding:0;border:0;}

 

body{background:#fff;color:#333;font-size:12px; margin-top:5px;font-family:"SimSun","宋體","Arial Narrow";}

 

ul,ol{list-style-type:none;}

 

select,input,img,select{vertical-align:middle;}

 

a{text-decoration:none;}

 

a:link{color:#009;}

 

a:visited{color:#800080;}

 

a:hover,a:active,a:focus{color:#c00;text-decoration:underline;}

相關文章
相關標籤/搜索