核心提示:這個“瀏覽器預設HTML的CSS樣式屬性”,在你需要還原預設值的時候,比較有用。開始的時候應用通配選取器 *{margin:0;padding:0;},當需要使用邊距的時候,就需要還原HTML預設CSS值了。
這個“瀏覽器預設HTML的CSS樣式屬性”,在你需要還原預設值的時候,比較有用。開始的時候應用通配選取器 *{margin:0;padding:0;},當需要使用邊距的時候,就需要還原HTML預設CSS值了。
但通配選取器在大型網站的構建中,影響效能,可以參考52CSS.com的相關文章,大家還是需要謹慎一些。
以前一直在找這份文檔,今天偶然在w3上看到了。除了inline和block的定義,主要是要注意bodyh1~h6blockquotemenuuloldd等標籤的預設樣式(margin和font-size)。
html, address, <br/>blockquote, <br/>body, dd, div, <br/>dl, dt, fieldset, form, <br/>frame, frameset, <br/>h1, h2, h3, h4, <br/>h5, h6, noframes, <br/>ol, p, ul, center, <br/>dir, hr, menu, pre { display: block } <br/>li { display: list-item } <br/>head { display: none } <br/>table { display: table } <br/>tr { display: table-row } <br/>thead { display: table-header-group } <br/>tbody { display: table-row-group } <br/>tfoot { display: table-footer-group } <br/>col { display: table-column } <br/>colgroup { display: table-column-group } <br/>td, th { display: table-cell; } <br/>caption { display: table-caption } <br/>th { font-weight: bolder; text-align: center } <br/>caption { text-align: center } <br/>body { margin: 8px; line-height: 1.12 } <br/>h1 { font-size: 2em; margin: .67em 0 } <br/>h2 { font-size: 1.5em; margin: .75em 0 } <br/>h3 { font-size: 1.17em; margin: .83em 0 } <br/>h4, p, <br/>blockquote, ul, <br/>fieldset, form, <br/>ol, dl, dir, <br/>menu { margin: 1.12em 0 } <br/><br/>h5 { font-size: .83em; margin: 1.5em 0 } <br/>h6 { font-size: .75em; margin: 1.67em 0 } <br/>h1, h2, h3, h4, <br/>h5, h6, b, <br/>strong { font-weight: bolder } <br/>blockquote { margin-left: 40px; margin-right: 40px } <br/>i, cite, em, <br/>var, address { font-style: italic } <br/>pre, tt, code, <br/>kbd, samp { font-family: monospace } <br/>pre { white-space: pre } <br/>button, textarea, <br/>input, object, <br/>select { display:inline-block; } <br/>big { font-size: 1.17em } <br/>small, sub, sup { font-size: .83em } <br/>sub { vertical-align: sub } <br/>sup { vertical-align: super } <br/>table { border-spacing: 2px; } <br/>thead, tbody, <br/>tfoot { vertical-align: middle } <br/>td, th { vertical-align: inherit } <br/>s, strike, del { text-decoration: line-through } <br/>hr { border: 1px inset } <br/>ol, ul, dir, <br/>menu, dd { margin-left: 40px } <br/>ol { list-style-type: decimal } <br/>ol ul, ul ol, <br/>ul ul, ol ol { margin-top: 0; margin-bottom: 0 } <br/>u, ins { text-decoration: underline } <br/>br:before { content: "\A" } <br/>:before, :after { white-space: pre-line } <br/><br/>center { text-align: center } <br/>abbr, acronym { font-variant: small-caps; letter-spacing: 0.1em } <br/>:link, :visited { text-decoration: underline } <br/>:focus { outline: thin dotted invert } <br/><br/>/* Begin bidirectionality settings (do not change) */ <br/>BDO[DIR="ltr"] { direction: ltr; unicode-bidi: bidi-override } <br/>BDO[DIR="rtl"] { direction: rtl; unicode-bidi: bidi-override } <br/><br/>*[DIR="ltr"] { direction: ltr; unicode-bidi: embed } <br/>*[DIR="rtl"] { direction: rtl; unicode-bidi: embed } <br/><br/>@media print { <br/>h1 { page-break-before: always } <br/>h1, h2, h3, <br/>h4, h5, h6 { page-break-after: avoid } <br/>ul, ol, dl { page-break-before: avoid }