最佳的方法「Reset CSS」
世界知名的 CSS 大師「Eric A. Meyer」整理出一個很棒的解決方法「Reset CSS」,針對 CSS 語法最容易出問題的部份~例如 margin 外間距,各大瀏覽器最常發生不一致的狀況,現在將 margin 全部統一歸 0 ,其他部份,文字大小和行高也全部統成一樣的大小 …. 等,只要掛上這一段「Reset CSS」語法,就可以讓所有的各大瀏覽器乖乖聽話,呈現一樣的結果,CSS 的大同世界就在這裡啊!
/* v1.0 | 20080212 */
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
margin: 0;
padding: 0;
border: 0;
outline: 0;
font-size: 100%;
vertical-align: baseline;
background: transparent;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
/* remember to define focus styles! */
:focus {
outline: 0;
}
/* remember to highlight inserts somehow! */
ins {
text-decoration: none;
}
del {
text-decoration: line-through;
}
/* tables still need 'cellspacing="0"' in the markup */
table {
border-collapse: collapse;
border-spacing: 0;
}
下載網站:http://meyerweb.com/eric/tools/css/reset/reset.css
參考來源:flycan