* { margin:0; padding:0; }
form 控制項)失去原生樣式針對具體元素清單重置,範例:
/* 清除內外邊距 */
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 {
border: medium none;
margin: 0;
padding: 0;
}
/* 設定預設字體 */
body, button, input, select, textarea {
font: 12px/1.5 '宋體', tahoma, Srial, helvetica, sans-serif;
}
h1, h2, h3, h4, h5, h6 { font-size: 100%; }
em { font-style: normal; }
/* 重置列表、超連結、圖片、表格 */
ul, ol { list-style: none; }
a { text-decoration: none; color:#333; }
a:hover { text-decoration: underline; color:#F40; }
img { border: 0; }
table { border-collapse: collapse; border-spacing: 0; }
精準針對需重置的元素清單,避免全域選擇器的效能與副作用問題。