透過 CSS 統一管理全站 <h1> 樣式,未來修改顏色、字體、大小只需改一處規則即可生效。
h1 {
font-family: Arial, sans-serif;
font-size: 24px;
color: #369; /* 品牌藍 */
}
效果:所有 <h1> 套用 Arial、24px、藍色。

h1 {
font-family: Arial, sans-serif;
font-size: 24px;
color: #369;
padding-bottom: 4px; /* 文字與底線間距 */
border-bottom: 1px solid #999; /* 灰色細線分隔 */
}
效果:標題下方出現優雅分隔線,增強層次感。

:root {
--heading-font: "Microsoft JhengHei", Arial, sans-serif;
--heading-color: #2c3e50;
--heading-line: #e0e0e0;
}
h1, h2, h3, h4, h5, h6 {
font-family: var(--heading-font);
color: var(--heading-color);
margin-top: 1.5em;
margin-bottom: 0.5em;
line-height: 1.3;
}
h1 { font-size: 2.5rem; border-bottom: 2px solid var(--heading-line); padding-bottom: .3em; }
h2 { font-size: 2rem; border-bottom: 1px solid var(--heading-line); padding-bottom: .2em; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; color: #666; }
h1,代表頁面主標題。<div class="hero-title"> 而非標題標籤。