極簡文件骨架
<!DOCTYPE html>
<html lang="zh-TW">
<head>
<meta charset="UTF-8">
<title>我的第一個網頁</title>
</head>
<body>
<h1>歡迎來到我的網站</h1>
<p>這是第一個段落。</p>
</body>
</html>
核心標籤速查
| 標籤 | 用途 | 關鍵屬性 | 範例 |
<h1>~<h6> | 標題 (h1 最高層級) | - | <h1>主標題</h1> |
<p> | 段落 | - | <p>內容...</p> |
<a> | 超連結 | href, target, rel, download | <a href="https://example.com" target="_blank" rel="noopener">連結</a> |
<img> | 圖片 | src, alt, width, height, loading | <img src="logo.png" alt="Logo" width="120" height="40" loading="lazy"> |
<ul>/<ol>/<li> | 無序/有序清單 | type, start, reversed | <ul><li>項目</li></ul> |
<dl>/<dt>/<dd> | 定義清單 | - | <dl><dt>術語</dt><dd>定義</dd></dl> |
<table> | 表格 | border (CSS 建議) | 見下方範例 |
<br> | 換行 | - | 文字<br>換行 |
<hr> | 水平分隔線 | - | <hr> |
<strong>/<em> | 重要/強調 | - | <strong>關鍵</strong> |
<blockquote> | 區塊引用 | cite | <blockquote cite="...">引用內容</blockquote> |
表格基本結構
<table>
<caption>課程表</caption>
<thead>
<tr><th scope="col">時間</th><th scope="col">科目</th></tr>
</thead>
<tbody>
<tr><td>09:00</td><td>HTML</td></tr>
<tr><td>10:00</td><td>CSS</td></tr>
</tbody>
</table>
實作練習建議
- 用 VS Code 建立 `index.html`,貼上骨架。
- 在 `` 依序加入:標題、段落、連結、圖片、無序清單、有序清單、定義清單、表格。
- 安裝擴充 **Live Server**,右鍵「Open with Live Server」即時預覽、存檔自動重整。
- 用 DevTools Elements 面板檢查 DOM 結構、Console 除錯。