CSS Portal

HTML <h2> Tag

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!

Description

The <h2> tag in HTML represents a second-level heading in a document. It is part of the heading hierarchy that ranges from <h1> to <h6>, where <h1> is the highest or most important level and <h6> is the lowest. The <h2> tag is typically used to denote subsections under the main heading (<h1>), helping to structure content in a logical and hierarchical manner.

Headings defined with <h2> are block-level elements, which means they start on a new line and usually have space above and below by default. Visually, browsers render <h2> text larger and bolder than normal paragraph text (<p>), but smaller than <h1>. The exact appearance can vary depending on the browser’s default styles or any custom CSS applied.

Using <h2> correctly is important for accessibility and SEO:

  • Accessibility: Screen readers use heading tags to navigate content efficiently. Properly nested headings (e.g., <h1> followed by <h2>) make it easier for users relying on assistive technologies to understand the page structure.
  • SEO: Search engines use headings to understand the structure and main topics of a webpage. Clear and relevant <h2> headings can improve a page’s visibility in search results.

Typically, a webpage will contain one <h1> heading representing the overall page topic, with multiple <h2> tags for major sections. <h2> headings can also contain inline elements such as <span> or <strong> to emphasize text, and they can be styled extensively with CSS for font size, color, spacing, and more.

Properties

Permitted Parents
Any element that accepts flow content.
Content
Inline and text
Start/End Tags
Start tag: required, End tag: required

Example

<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
<h4>Heading 4</h4>
<h5>Heading 5</h5>
<h6>Heading 6</h6>

Attributes

None

Global Attributes

The <h1> tag also supports the Global Attributes in HTML5

Event Attributes

The <h1> tag also supports the Event Attributes in HTML5

Browser Support

The following information will show you the current browser support for the HTML <h2> tag. Hover over a browser icon to see the version that first introduced support for this HTML tag.

This tag is supported by all modern browsers.
Desktop
Chrome
Edge
Firefox
Opera
Safari
Tablets & Mobile
Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-

Last updated by CSSPortal on: 26th December 2025

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!