HTML標簽在瀏覽器中都有默認的樣式,不同的瀏覽器的默認樣式之間存在差別。例如ul默認帶有縮進樣式,在IE下,它的縮進是由margin實現的,而在Firefox下卻是由padding實現的。開發時瀏覽器的默認樣式可能會給我們帶來多瀏覽器兼容性問題,影響開發效率。現在很流行的解決方式是一開始就將瀏覽器的默認樣式全部覆蓋掉,這就是css reset。
部分css reset內容如下:
html {color:#000;background:#FFF;}t5
body,div,dl,dt,dd,ul,ol,li,
h
1
,h
2
,h
3
,h
4
,h
5
,h
6
,
pre
,
code
,form,fieldset,legend,
input,textarea,p,blockquote,th,td{
margin
:
0
;
padding
:
0
;}
table {
border-collapse
:
collapse
;
border-spacing
:
0
;}
fieldset,img {
border
:
0
;}
address,
caption
,cite,
code
,dfn,em,strong,th,var {
font-style
:
normal
;
font-weight
:
normal
;}
li {
list-style
:
none
;}
caption
,th {
text-align
:
left
;}
h
1
,h
2
,h
3
,h
4
,h
5
,h
6
{
font-size
:
100%
;
font-weight
:
normal
;}
q:before,q:after {
content
:
''
;}
abbr,acronym {
border
:
0
;
font-variant
:
normal
;}
sup {
vertical-align
:
text-top
;}
sub
{
vertical-align
:
text-bottom
;}
input,textarea,select {
font-family
:inherit;
font-size
:inherit;
font-weight
:inherit;}
input,textarea,select {*
font-size
:
100%
;}
legend {
color
:
#000
;}
