萬盛學電腦網

您现在的位置: 萬盛學電腦網 >> 程式設計 >  >> 網頁製作 >> HTML5 教學

HTML 標籤大全速查表:文字、圖片、表格、表單、多媒體、語意化標籤分類整理

文字與語意標籤

標籤用途HTML5 新增/廢棄
<h1>-<h6>標題層級—
<p>段落—
<strong>重要/強調(粗體)—
<em>強調(斜體)—
<mark>標記/高亮HTML5 新增
<small>細則/側註語意化調整
<del>/<ins>刪除/插入修訂—
<abbr>縮寫(title 提示全寫)—
<cite>作品標題引用—
<q>/<blockquote>行內/區塊引用—
<code>/<pre>程式碼/預格式化—
<time>機器可讀時間HTML5 新增
<b>/<i>/<u>純視覺粗/斜/底線建議改用語意標籤

圖片與多媒體

<img src="photo.webp" alt="描述" width="400" height="300" loading="lazy" decoding="async">
<picture>
  <source type="image/avif" srcset="photo.avif">
  <source type="image/webp" srcset="photo.webp">
  <img src="photo.jpg" alt="fallback">
</picture>
<video controls preload="metadata" poster="cover.jpg">
  <source src="video.mp4" type="video/mp4">
  <track kind="subtitles" src="sub.vtt" srclang="zh" label="中文">
</video>
<audio controls><source src="audio.mp3" type="audio/mpeg"></audio>

表格核心結構

<table>
  <caption>月銷售報表</caption>
  <thead><tr><th scope="col">月份</th><th scope="col">金額</th></tr></thead>
  <tbody>
    <tr><th scope="row">1月</th><td>$1,200</td></tr>
    <tr><th scope="row">2月</th><td>$1,500</td></tr>
  </tbody>
  <tfoot><tr><th scope="row">總計</th><td>$2,700</td></tr></tfoot>
</table>

表單關鍵標籤

<form action="/api" method="post">
  <label for="email">Email</label>
  <input id="email" name="email" type="email" required autocomplete="email">
  <fieldset>
    <legend>偏好設定</legend>
    <label><input type="checkbox" name="notify" value="email"> Email 通知</label>
  </fieldset>
  <button type="submit">送出</button>
</form>

語意化結構標籤(HTML5 新增)

  • <header>, <footer>, <main>, <nav>, <article>, <section>, <aside>, <figure>, <figcaption>, <details>, <summary>, <dialog>

廢棄/不建議標籤(改用 CSS)

<font>, <center>, <strike>, <big>, <tt>, <frame>, <frameset>, <noframes>, <acronym>, <applet>, <bgsound>, <marquee>, <blink>

copyright © 萬盛學電腦網 all rights reserved