/* 類型選擇器 = 標籤名 */
body { margin: 0; }
p { line-height: 1.6; }
ul, ol { padding-left: 1.5rem; }
a { color: #0066cc; }
(0,0,0,1),最低 (除通配符)。/* 消除瀏覽器默認差異 */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 100%; -webkit-text-size-adjust: 100%; }
body { margin: 0; line-height: 1.5; }
img, video, canvas { max-width: 100%; height: auto; display: block; }
不歸零,而是**標準化**:保留 h1-h6 字級層級、ul/ol 列表樣式、strong/em 語義強調等。
/* 專案通用排版,極少覆蓋 */
body { font-family: var(--font-sans); color: var(--color-text); }
h1, h2, h3, h4 { font-family: var(--font-heading); font-weight: 700; }
p, li { margin-block: 1em; }
a { text-underline-offset: 2px; }
/* ❌ 極難維護 */
.card p { color: #666; }
.card ul { margin: 1rem 0; }
.sidebar a { text-decoration: none; }
問題:
p 為 div 樣式失效)p 受影響)/* ✅ 基礎層 (reset/typography.css) — 類型選擇器 */
p { margin-block: 1em; }
/* ✅ 組件層 (card.css) — 語義化類 */
.card__text { color: var(--color-muted); }
.card__list { margin: 1rem 0; }
/* 針對所有按鈕類元素,包含
類型選擇器是 **「地基石」而非「磚塊」**。僅在 **Reset、Normalize、全局排版基準** 三大基礎層使用。業務組件**嚴禁**直接寫標籤選擇器,改用語義化 Class (BEM) 或 CSS Modules 隔離。這樣 HTML 結構自由變動,樣式穩如磐石。