HTML <h2> Tag
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
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
Tablets & Mobile
Last updated by CSSPortal on: 26th December 2025
