HTML 5 <h1> 至 <h6> 標(biāo)簽
定義和用法
<h1> - <h6> 標(biāo)簽可定義標(biāo)題。<h1> 定義最大的標(biāo)題。<h6> 定義最小的標(biāo)題。
由于 h 元素?fù)碛写_切的語(yǔ)義,因此請(qǐng)您慎重地選擇恰當(dāng)?shù)臉?biāo)簽層級(jí)來(lái)構(gòu)建文檔的結(jié)構(gòu)。因此,請(qǐng)不要利用標(biāo)題標(biāo)簽來(lái)改變同一行中的字體大小。相反,我們應(yīng)當(dāng)使用層疊樣式表定義來(lái)達(dá)到漂亮的顯示效果。
如果您希望了解更多有關(guān) HTML 標(biāo)簽選擇和使用的信息,請(qǐng)閱讀《Web 品質(zhì)》。
HTML 4.01 與 HTML 5 之間的差異
在 HTML 4.01 中,h1 - h6 元素的 "align" 屬性不被贊成使用。
在 HTML 5 中,h1 - h6 元素的 "align" 屬性不被支持。
例子
<h1>這是標(biāo)題 1</h1> <h1>這是標(biāo)題 2</h1> <h2>這是標(biāo)題 3</h2> <h4>這是標(biāo)題 4</h4> <h5>這是標(biāo)題 5</h5> <h6>這是標(biāo)題 6</h6>
屬性
標(biāo)準(zhǔn)屬性
class, contenteditable, contextmenu, dir, draggable, id, irrelevant, lang, ref, registrationmark, tabindex, template, title
如需完整的描述,請(qǐng)?jiān)L HTML 5 中標(biāo)準(zhǔn)屬性。
事件屬性
onabort, onbeforeunload, onblur, onchange, onclick, oncontextmenu, ondblclick, ondrag, ondragend, ondragenter, ondragleave, ondragover, ondragstart, ondrop, onerror, onfocus, onkeydown, onkeypress, onkeyup, onload, onmessage, onmousedown, onmousemove, onmouseover, onmouseout, onmouseup, onmousewheel, onresize, onscroll, onselect, onsubmit, onunload
如需完整的描述,請(qǐng)?jiān)L HTML 5 中事件屬性。
TIY 實(shí)例
- 標(biāo)題
- 本例演示在 HTML 文檔中顯示標(biāo)題的標(biāo)簽。