萬盛學電腦網

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

HTML 常用標籤分類速查表:結構、文本、表單、媒體、語義化一網打盡

文檔結構標籤

標籤用途
<html>根元素
<head>元數據容器
<title>文檔標題
<body>可見內容區
<header>頁首/區塊頭
<footer>頁腳/區塊尾
<nav>導航鏈接群
<main>主內容區(唯一)
<article>獨立完整內容
<section>主題性區塊
<aside>側邊欄/附註

文本語義標籤

標籤語義默認樣式
<h1>-<h6>標題層級粗體、字號遞減
<p>段落上下邊距
<strong>重要/嚴肅粗體
<em>強調斜體
<mark>高亮/標記黃背景
<small>側註/小字小字號
<del>刪除內容刪除線
<ins>插入內容下劃線
<code>行內代碼等寬字體
<pre>預格式化塊保留空白換行
<blockquote>塊級引用縮進
<q>行內引用自動加引號
<cite>作品標題斜體
<abbr>縮寫底部虛線+title提示
<time>時間日期無特殊樣式
<sup>/<sub>上/下標字號縮小上移/下移

列表標籤

  • <ul> + <li>:無序列表
  • <ol> + <li>:有序列表(type, start, reversed)
  • <dl> + <dt>(術語) + <dd>(描述):描述列表

表單標籤

標籤用途關鍵屬性
<form>表單容器action, method, enctype
<input>輸入控件type(text/password/email/number/date/checkbox/radio/file/hidden…), name, value, required, placeholder
<textarea>多行文本rows, cols, maxlength
<select> + <option>下拉選單multiple, size
<button>按鈕type(submit/reset/button)
<label>標籤綁定for=input_id
<fieldset>/<legend>分組/標題—
<datalist>輸入建議配合 input list 屬性
<output>計算結果for=關聯input_id

媒體與嵌入

  • <img>:圖片(src, alt, width, height, loading=lazy)
  • <picture> + <source>:響應式圖片
  • <video>/<audio>:媒體播放(controls, autoplay, loop, preload)
  • <iframe>:嵌套瀏覽上下文
  • <canvas>:位圖繪圖
  • <svg>:矢量圖形

表格標籤

<table>, <caption>, <thead>, <tbody>, <tfoot>, <tr>, <th>, <td>, <colgroup>, <col>。屬性:colspan, rowspan, headers。

已棄用/不推薦標籤(了解即可)

<font>, <center>, <strike>, <u>, <big>, <tt>, <frame>, <frameset>, <marquee>, <blink> — 請用 CSS 替代。

copyright © 萬盛學電腦網 all rights reserved