English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Reference Manual

Complete list of HTML tags

HTML: <h2tag

HTML <h2> The <h tag defines the second-level heading in an HTML document. This tag is also commonly referred to as <h2> element.

Online example

 HTML h2Title:

!doctype html
<html>
<head>
<meta charset="UTF-8">
<title>HTML5 H2Usage of tags (Basic Tutorial Website oldtoolbag.com)</title>
</head>
<body>
<h1>Heading 1</h1>
<p>This is the content that would appear under Heading 1.</p>
<h2>Heading 2</h2>
<p>This is the content that would appear under Heading 2.</p>
</body>
</html>
Test to see ‹/›

Browser compatibility

IEFirefoxOperaChromeSafari

All mainstream browsers support <h2> Tag.

tag definition and usage instructions

HTML <h2> element is located within the<body> tag.

The range of headings can be from<h1> to<h6>.1> The least important heading is<h6>.

in<h1> after the heading to find<h2> headings. Do not skip heading levels.

<h2> headings are usually displayed in font size smaller than<h1> for small headings.

Do not just use<h2tags to apply other formatting.<h2tags are used to define heading levels, for example in a table of contents.

HTML 4.01 and HTML5differences between

In HTML 4.01 in, <h2> tag's "align" attribute has been deprecated. In HTML 5 in, <h2The "align" attribute of the element is not supported. Please use CSS to align elements.

Attribute

AttributeValueDescription
alignleft
center
right
justify
HTML5 Not supported. HTML 4.01 Deprecated. Defines the alignment of the title text.

Global Attributes

<h2tag support HTML Global Attributes.

event attributes

<h2tag support HTML Event Attributes.

Related Articles

HTML Tutorial:HTML Titles