可以將HTML標題或HTML h標簽定義為要在網頁上顯示的標題或副標題。當你將文本放在標題標簽
……… h1>內時, 它在瀏覽器中以粗體顯示, 并且文本的大小取決于標題的數量。
從
到
標簽定義了六個不同的HTML標題, 從最高級別h1(主標題)到最低級別h6(最重要的標題)。
h1是最大的標題標簽, h6是最小的標題標簽。因此, h1用于最重要的標題, h6用于最不重要的標題。
HTML中的標題可幫助搜索引擎理解網頁并為其編制索引。
注意:網頁整個內容的主要關鍵字應通過h1標題標簽顯示。
請參閱以下示例:
Heading no. 1
Heading no. 2
Heading no. 3
Heading no. 4
Heading no. 5
Heading no. 6
立即測試
輸出:
Heading no. 1
Heading no. 2
Heading no. 3
Heading no. 4
Heading no. 5
Heading no. 6
標題元素(h1 …. h6)僅應用于標題。它們不應僅用于使文本加粗或變大。
HTML標題也可以與嵌套元素一起使用。以下是顯示標題元素使用方式的不同代碼。
例:
Heading elementsThis is main heading of page.
h1 is the most important heading, which is used to display the keyword of page
This is first sub-heading
h2 describes the first sub heading of page.
This is Second sub-heading
h3 describes the second sub heading of page.
We can use h1 to h6 tag to use the different sub-heading with their paragraphs if
required.
輸出:
支持的瀏覽器
Element
Chrome
IE
Firefox
Opera
Safari
至
Yes
Yes
Yes
Yes
Yes