* { margin:0; padding:0; }?僅重置必要元素,保留有用的預設行為。以下為精簡重置範例:
/* 1. 邊距與邊框歸零 */
body, h1, h2, h3, h4, h5, h6, hr, p, blockquote,
dl, dt, dd, ul, ol, li,
pre,
form, fieldset, legend, button, input, textarea,
th, td,
img {
margin: 0;
padding: 0;
border: 0;
}
/* 2. 字體基準 */
body, button, input, select, textarea {
font: 12px/1.5 "Microsoft JhengHei", Tahoma, Arial, sans-serif;
}
h1, h2, h3, h4, h5, h6 { font-size: 100%; }
em { font-style: normal; }
/* 3. 列表樣式 */
ul, ol { list-style: none; }
/* 4. 連結基準 */
a { text-decoration: none; color: #333; }
a:hover { text-decoration: underline; color: #f40; }
/* 5. 圖片與表格 */
img { border: 0; vertical-align: middle; }
table { border-collapse: collapse; border-spacing: 0; }
直接引用 Normalize.css 或 Sanitize.css,再疊加專案基準樣式,最省時且穩健。