| 元素/屬性 | Chrome/Firefox | Safari | IE/Edge Legacy | 備註 |
|---|---|---|---|---|
body margin | 8px | 8px | 15px / 10px | 需統一歸零 |
ul, ol padding | 40px (left) | 40px | 20px / 0 | 列表縮進差異大 |
h1-h6 font-size | 2em / 1.5em / 1.17em / 1em / 0.83em / 0.67em | 類似 | 類似 | 相對單位受瀏覽器預設字體影響 |
button, input font | 不繼承 body | 不繼承 | 不繼承 | 需 font:inherit |
background-color | transparent | transparent | transparent | 一致 |
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, 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,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin:0; padding:0; border:0; font-size:100%; font:inherit; vertical-align:baseline;
}
徹底歸零,但需大量重寫樣式、檔案大。
sup 上標、sub 下標、b 粗體)npm install normalize.css → @import "normalize.css";/* 專案常用最小集 */
*, *::before, *::after { box-sizing:border-box; }
html { -webkit-text-size-adjust:100%; -moz-tab-size:4; tab-size:4; }
body { margin:0; line-height:1.5; font-family:system-ui, sans-serif; }
img, video, canvas { display:block; max-width:100%; height:auto; }
ul, ol { margin:0; padding:0; list-style:none; }
a { color:inherit; text-decoration:none; }
button, input, select, textarea { font:inherit; color:inherit; }
table { border-collapse:collapse; }