我们都知道,一些html标签通常都带有默认css样式,我们在写网页时,这些默认的样式就会时不时的跳出来捣一下乱,搞得我们很是无奈。
所以成手在写css样式时,一般都会在开头写一段初始化程序,来去掉这些默认样式,最简单的方法就是使用*{margin:0;padding:0;}。
但是通常我们很少使用这种方法,因为通配符*的效率极低。
所以我们要先熟悉标签的默认样式,再来研究怎么对付他们。
003 |
html,
body, div,ol, p, ul, h1, h2,h3,h4,h5, h6, |
005 |
address,blockquote,
form, |
007 |
dd,dl,
dt, fieldset, frame, frameset,noframes,center, dir, hr, menu, pre |
015 |
li{
display:list-item } |
017 |
ol{list-style-type:
decimal } |
019 |
ol
ul, ul ol,ul ul, ol ol { margin-top: 0; margin-bottom: 0 } |
021 |
ol,
ul{ margin-left: 40px } |
027 |
i,
cite, em, var ,
address{ font-style: italic } |
029 |
big{
font-size:1.17em } |
031 |
small,
sub, sup{ font-size: .83em } |
033 |
sub{
vertical-align:sub } |
035 |
sup{
vertical-align:super } |
037 |
s,
strike, del{ text-decoration: line-through } |
039 |
u,
ins{ text-decoration:underline } |
045 |
h1{
font-size:2em; margin: .67em 0 } |
047 |
h2{
font-size:1.5em; margin: .75em 0 } |
049 |
h3{
font-size:1.17em; margin: .83em 0 } |
051 |
h4,
p,blockquote, ul,fieldset, form,ol, dl, dir,menu { margin: 1.12em 0} |
053 |
h5
{ font-size:.83em; margin: 1.5em 0 } |
055 |
h6{
font-size:.75em; margin: 1.67em 0 } |
057 |
h1,
h2, h3, h4,h5, h6, b,strong { font-weight: bolder } |
065 |
br:before{
content: ”\A” } |
067 |
:before,
:after{ white-space: pre-line } |
069 |
:link,
:visited { text-decoration: underline } |
071 |
:focus{
outline: thin dotted invert } |
077 |
table{
display: table } |
079 |
tr{
display:table-row } |
081 |
thead{
display:table-header-group } |
083 |
tbody{
display:table-row-group } |
085 |
tfoot{
display:table-footer-group } |
087 |
col{
display:table-column } |
089 |
colgroup{
display:table-column-group } |
091 |
td,
th{ display: table-cell;} |
093 |
caption{
display: table-caption } |
095 |
th{font-weight:
bolder; text-align: center } |
097 |
caption{
text-align: center } |
099 |
table{
border-spacing: 2px;} |
101 |
thead,
tbody,tfoot { vertical-align:middle } |
103 |
td,
th { vertical-align:inherit } |
109 |
head{
display: none } |
111 |
body{
margin: 8px;line-height: 1.12 } |
113 |
button,
textarea,input, object,select { display:inline-block;} |
115 |
blockquote{
margin-left: 40px;margin-right: 40px } |
117 |
pre,
tt, code,kbd, samp { font-family: monospace } |
119 |
pre{
white-space: pre} |
121 |
hr{
border: 1px inset } |
123 |
center{
text-align: center } |
125 |
abbr,
acronym{ font-variant: small-caps; letter-spacing:0.1em } |
129 |
BDO[DIR= "ltr" ]
{ direction: ltr; unicode-bidi:bidi-override } |
131 |
BDO[DIR= "rtl" ]
{ direction: rtl; unicode-bidi:bidi-override } |
135 |
*[DIR= "ltr" ]{
direction: ltr;unicode-bidi: embed } |
137 |
*[DIR= "rtl" ]
{ direction: rtl;unicode-bidi: embed } |
143 |
h1{page- break -before:
always } |
145 |
h1,
h2, h3,h4, h5, h6 { page- break -after:
avoid } |
147 |
ul,
ol, dl{ page- break -before:
avoid } |
我认为我们可以把能用的样式留着,不能用的就通过常用标签选择器给初始化一下,这样才能提高效率