HyperText Markup Language:超文本標記語言。非程式語言 (無編譯、無邏輯運算),而是標記語言,透過標籤賦予內容結構與語意,由瀏覽器解析渲染。
<a href>) 連結分散資源,構成 Web 網狀結構<article> vs <div class="article">)<!DOCTYPE html> <!-- HTML5 文檔類型宣告,啟用標準模式 -->
<html lang="zh-Hant"> <!-- 根元素,宣告語言 -->
<head> <!-- 元資料,不顯示於畫面 -->
<meta charset="UTF-8">
<title>頁面標題</title>
<link rel="stylesheet" href="style.css">
<script src="app.js" defer></script>
</head>
<body> <!-- 可見內容 -->
<header>...</header>
<main>...</main>
<footer>...</footer>
</body>
</html>
| 類別 | 代表標籤 | 內容模型 | 典型父層 |
|---|---|---|---|
| 文檔結構 | html, head, body, title, meta, link, script, style | 特定 | html |
| 區塊語意 | header, footer, nav, main, section, article, aside, div | Flow content | body, 區塊容器 |
| 文字語意 | h1-h6, p, span, a, strong, em, cite, q, time, mark | Phrasing content | 區塊/文字容器 |
| 列表 | ul, ol, li, dl, dt, dd | 特定 | 區塊容器 |
| 表格 | table, thead, tbody, tfoot, tr, th, td, caption | 特定 | 區塊容器 |
| 表單 | form, input, button, select, textarea, label, fieldset, legend | 特定 | 區塊容器 |
| 嵌入內容 | img, video, audio, canvas, iframe, svg, picture | Empty / Transparent | 文字/區塊容器 |
| 互動/腳本 | details, summary, dialog, script, noscript, template, slot | 特定 | 各處 |
<p>內容</p>、<div>...</div> (大多數)<br>, <hr>, <img>, <input>, <meta>, <link>, <area>, <base>, <col>, <embed>, <param>, <source>, <track>, <wbr> — HTML5 無需斜線bgcolor, align, font)htmlhint