CSS Reset 的目標是降低瀏覽器預設樣式差異,讓頁面有一致的起點。常見做法包括清除邊距、列表樣式、標題大小與表單元素字體設定。
html{color:#000;background:#fff;}
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,input,button,textarea,p,blockquote,th,td{
margin:0;
padding:0;
}
body{
font:12px/1 Tahoma,Helvetica,Arial,"\5b8b\4f53",sans-serif;
}
img{border:none;}
em,strong{font-style:normal;font-weight:normal;}
li{list-style:none;}
table{border-collapse:collapse;border-spacing:0;}
h1{font-size:18px;}
h2{font-size:16px;}
h3{font-size:14px;}
h4,h5,h6{font-size:100%;}
q:before,q:after{content:'';}
button,input,select,textarea{font-size:100%;}
input,button,textarea,select,optgroup,option{
font-family:inherit;
font-size:inherit;
font-style:inherit;
font-weight:inherit;
}
a{color:#36c;text-decoration:none;}
a:hover{color:#f60;text-decoration:underline;}
實際專案可依需求增減重置項目,避免重置過多而增加後續樣式負擔。