HTML 學習路徑全規劃:從標記基礎到語義化標籤,零基礎掌握網頁結構核心技能
階段一:核心概念建立(1-2 週)
- 理解 HTML 是什麼:標記語言、超文本、解釋執行。
- 文檔骨架:
<!DOCTYPE html>、<html>、<head>、<body>。
- 常用標籤分類記憶:
- 結構:
div, span, header, footer, main, section, article, aside, nav
- 文本:
h1-h6, p, strong, em, blockquote, code, pre
- 列表:
ul, ol, li, dl, dt, dd
- 媒體:
img, video, audio, picture, figure, figcaption
- 表單:
form, input, textarea, select, button, label, fieldset, legend
- 表格:
table, thead, tbody, tfoot, tr, th, td, caption
階段二:屬性與語法規範(1 週)
- 全局屬性:
id, class, style, title, data-*, aria-*。
- 布爾屬性:
disabled, required, checked, selected, hidden 可省略值。
- 特殊字符轉義:
< > & " 。
- 嵌套規則:流式內容、措辭內容、章節根等內容模型(查閱 MDN「Content categories」)。
階段三:語義化與無障礙(持續練習)
- 用正確標籤表達含義:導航用
<nav>、側邊欄用 <aside>、獨立文章用 <article>。
- ARIA 輔助:
role, aria-label, aria-hidden, aria-expanded 僅在原生標籤無法滿足時使用。
- 鍵盤可訪問:
tabindex、焦點樣式、跳過鏈接。
階段四:實戰項目驅動(持續)
- 克隆簡單靜態頁(如 Blog、產品介紹頁)。
- 使用語義化標籤重構非語義代碼。
- 引入 CSS 完成佈局,體會結構與樣式分離。
- 學習 Emmet 語法加速編寫:
ul>li*3>a[href=#] 展開為列表。
推薦學習資源
- MDN Web Docs《HTML 基礎》教程(權威、持續更新)。
- 《HTML & CSS: Design and Build Websites》Jon Duckett(圖文並茂)。
- W3Schools HTML 教程(快速查閱語法)。
- Can I Use(查詢標籤/屬性瀏覽器兼容性)。
避坑指南
- ❌ 用
<div> 做按鈕 → ✅ <button>。
- ❌
<h1> 多個用於 SEO → ✅ 每頁唯一 h1,層級順序 h1→h2→h3。
- ❌ 內聯樣式滿天飛 → ✅ 外部 CSS + BEM 命名。
- ❌ 忽略驗證 → ✅ 習慣用 W3C Validator 檢查。
copyright ©
萬盛學電腦網 all rights reserved