<body> 標籤核心屬性與現代 CSS 替代方案| 屬性 | 用途 | CSS 替代 |
|---|---|---|
| bgcolor | 背景顏色 | background-color |
| background | 背景圖片 | background-image |
| text | 文字顏色 | color |
| link | 未造訪連結顏色 | a:link { color } |
| vlink | 已造訪連結顏色 | a:visited { color } |
| alink | 點擊瞬間連結顏色 | a:active { color } |
| topmargin | 上邊距 | margin-top / body { margin:0 } |
| leftmargin | 左邊距 | margin-left |
| rightmargin | 右邊距 | margin-right |
| bottommargin | 下邊距 | margin-bottom |
/* CSS Reset / Normalize 片段 */
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
margin: 0;
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
line-height: 1.5;
color: #212529;
background-color: #fff;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
a { color: #0d6efd; text-decoration: underline; }
a:hover { color: #0a58ca; }
onload, onunload 等事件屬性(建議改用 `addEventListener`)class, id, style, data-* 通用屬性所有表現屬性已移至 CSS,HTML 僅保留結構與語意。採用 CSS Reset/Normalize 確保跨瀏覽器一致基線,再依設計系統客製化 body 樣式。