Total Pageviews

Thursday, 1 March 2012

HTML标签的默认CSS样式

在html中,即使我们没有指定页面元素显示的css样式,元素也会按照默认的的标准css样式去显示。因此掌握基本的html标签可以在一定程度上精简你的css代码,现将html标签的默认属性进行一定的汇总如下:
1li              { display: list-item }
2head            { display: none }
3table           { display: table }
4tr              { display: table-row }
5thead           { display: table-header-group }
6tbody           { display: table-row-group }
7tfoot           { display: table-footer-group }
8col             { display: table-column }
9colgroup        { display: table-column-group }
10td, th          { display: table-cell; }
11caption         { display: table-caption }
12th              { font-weight: bolder; text-align: center }
13caption         { text-align: center }
14body            { margin: 8px; line-height: 1.12 }
15html, address,blockquote,body, dd, div,dl, dt, fieldset, form,frame, frameset,h1, h2, h3, h4,h5, h6, noframes,ol, p, ul, center,dir, hr, menu, pre   { display: block }
16h4, p,blockquote, ul,fieldset, form,ol, dl, dir,menu            { margin: 1.12em 0 }
17h1              { font-size: 2em; margin: .67em 0 }
18h2              { font-size: 1.5em; margin: .75em 0 }
19h3              { font-size: 1.17em; margin: .83em 0 }
20h5              { font-size: .83em; margin: 1.5em 0 }
21h6              { font-size: .75em; margin: 1.67em 0 }
22h1, h2, h3, h4,h5, h6, b,strong          { font-weight: bolder }
23blockquote      { margin-left: 40px; margin-right: 40px }
24i, cite, em, var, address    { font-style: italic }
25pre, tt, code, kbd, samp     { font-family: monospace }
26pre             { white-space: pre }
27button, textarea, input, object, select          { display:inline-block; }
28big             { font-size: 1.17em }
29small, sub, sup { font-size: .83em }
30sub             { vertical-align: sub }
31sup             { vertical-align: super }
32table           { border-spacing: 2px; }
33thead, tbody, tfoot           { vertical-align: middle }
34td, th          { vertical-align: inherit }
35s, strike, del  { text-decoration: line-through }
36hr              { border: 1px inset }
37ol, ul, dir, menu, dd        { margin-left: 40px }
38ol              { list-style-type: decimal }
39ol ul, ul ol, ul ul, ol ol    { margin-top: 0; margin-bottom: 0 }
40u, ins          { text-decoration: underline }
41br:before       { content: “\A” }
42:before, :after { white-space: pre-line }
43 
44center          { text-align: center }
45abbr, acronym   { font-variant: small-caps; letter-spacing: 0.1em }
46:link, :visited { text-decoration: underline }
47:focus          { outline: thin dotted invert }
48 
49@media print {
50h1            { page-break-before: always }
51h1, h2, h3,h4, h5, h6    { page-break-after: avoid }
52ul, ol, dl    { page-break-before: avoid }
53}
54 
55BDO[DIR="ltr"]  { direction: ltr; unicode-bidi: bidi-override }
56BDO[DIR="rtl"]  { direction: rtl; unicode-bidi: bidi-override }
57 
58*[DIR="ltr"]    { direction: ltr; unicode-bidi: embed }
59*[DIR="rtl"]    { direction: rtl; unicode-bidi: embed }
当我们预想的css样式和默认样式一致时,我们就不必浪费不必要的css代码在那些页面元素上了,从而达到css代码的精简!

No comments:

Post a Comment