比較全的css重設

來源:互聯網
上載者:User

標籤:style   blog   io   ar   color   sp   for   strong   on   

一.最簡化的CSS Reset(重設) :

* {      padding: 0;      margin: 0;}

這是最普遍最簡單的CSS重設,將所有元素的padding和margin值都設為0,可以避免一些瀏覽器在理解這兩個屬性預設值上的”分歧”。

二.濃縮實用型CSS Reset(重設):

* {       vertical-align: baseline;       font-weight: inherit;       font-family: inherit;       font-style: inherit;       font-size: 100%;       outline: 0;       padding: 0;       margin: 0;       border: 0;}

三.Poor Man 的CSS Reset:

html, body {       padding: 0;       margin: 0;}html {       font-size:1em;}body {       font-size:100%;}a img, :link img, :visited img {       border:0px;}

這個重設方法將html和body下元素的padding和margin都設為0,並分別為html標籤和body標籤下的所有元素設定了初始的字型大小,最重要的是把有連結的圖片的預設邊框去掉了。

四.Siolon’s Global Reset

{    vertical-align: baseline;    font-family: inherit;    font-style: inherit;    font-size: 100%;    border: none;    padding: 0;    margin: 0;}body {    padding: 5px;}h1, h2, h3, h4, h5, h6, p, pre, blockquote, form, ul, ol, dl {    margin: 20px 0;}li, dd, blockquote {    margin-left: 40px;}table {    border-collapse: collapse;    border-spacing: 0;} 

 

五.Shaun Inman’s Global Reset

body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, form, fieldset, input, p, blockquote, table, th, td, embed, object {    padding: 0;    margin: 0;}table {    border-collapse: collapse;    border-spacing: 0;}    fieldset, img, abbr {    border: 0;}address, caption, cite, code, dfn, em,h1, h2, h3, h4, h5, h6, strong, th, var {    font-weight: normal;    font-style: normal;}ul {    list-style: none;}caption, th {    text-align: left;}h1, h2, h3, h4, h5, h6 {    font-size: 1.0em;}q:before, q:after {    content: ”;}a, ins {    text-decoration: none;}

六.Yahoo(YUI) CSS Reset:

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;}address,caption,cite,code,dfn,em,strong,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;}

七.Eric Meyer’s CSS Reset

html, body, div, span, applet, object, iframe, table, caption,tbody, tfoot, thead, tr, th, td, del, dfn, em, font, img, ins,kbd, q, s, samp, small, strike, strong, sub, sup, tt, var,h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr,acronym, address, big, cite, code, dl, dt, dd, ol, ul, li,fieldset, form, label, legend {    vertical-align: baseline;    font-family: inherit;    font-weight: inherit;    font-style: inherit;    font-size: 100%;    outline: 0;    padding: 0;    margin: 0;    border: 0;}:focus {    outline: 0;}body {    background: white;    line-height: 1;    color: black;}ol, ul {    list-style: none;}table {    border-collapse: separate;    border-spacing: 0;}caption, th, td {    font-weight: normal;    text-align: left;}blockquote:before, blockquote:after, q:before, q:after {    content: “”;}blockquote, q {    quotes: “” “”;}

八.Condensed Meyer Reset:

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;}    fieldset, img {    border: 0;}table {    border-collapse: collapse;    border-spacing: 0;}ol, ul {    list-style: none;}address, caption, cite, code, dfn, em, strong, th, var {    font-weight: normal;    font-style: normal;}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;}

九.Ateneu Popular CSS Reset

html, body, div, span, applet, object, iframe, h1, h2, h3,h4, h5, h6, p, blockquote, pre, a, abbr, acronym,address, big, cite, code, del, dfn, em, font, img, ins,kbd, q, s, samp, small, strike, strong, sub, sup, tt,var, dl, dt, dd, ol, ul, li, fieldset, form, label, legend,table, caption, tbody, tfoot, thead, tr, th, td {    margin: 0;    padding: 0;    border: 0;    outline: 0;    font-weight: inherit;    font-style: inherit;    font-size: 100%;    font-family: inherit;    vertical-align: baseline;}:focus {    outline: 0;}a, a:link, a:visited, a:hover, a:active{    text-decoration:none}table {    border-collapse: separate;    border-spacing: 0;}th, td {    text-align: left;    font-weight: normal;}img, iframe {    border: none;    text-decoration:none;}ol, ul {    list-style: none;}input, textarea, select, button {    font-size: 100%;    font-family: inherit;}select {    margin: inherit;}hr {    margin: 0;    padding: 0;    border: 0;    color: #000;    background-color: #000;    height: 1px}

十、CSSLab CSS Reset

html,body, div, span, applet, object, iframe, h1, h2, h3,h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address,big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp,small, strike, strong, sub, sup, tt, var, dl, dt, dd, ol, ul, li,fieldset, form, label, legend, table, caption, tbody, tfoot,thead, tr, th, td {    margin: 0;    padding: 0;    border: 0;    outline: 0;    font-weight: inherit;    font-style: inherit;    font-size: 100%;    font-family: inherit;    vertical-align: baseline;}:focus {    outline: 0;}table {    border-collapse: separate;    border-spacing: 0;}caption, th, td {    text-align: left;    font-weight: normal;}a img, iframe {    border: none;}ol, ul {    list-style: none;}input, textarea, select, button {    font-size: 100%;    font-family: inherit;}select {    margin: inherit;}/* Fixes incorrect placement of numbers in ol’s in IE6/7 */ol { margin-left:2em; }/* == clearfix == */.clearfix:after {    content: “.”;    display: block;    height: 0;    clear: both;    visibility: hidden;}.clearfix {display: inline-block;}* html .clearfix {height: 1%;}.clearfix {display: block;} 

 

比較全的css重設

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.