Heading Tags

By Ava Webber | Created on 2025-09-10 09:09:10

Written with a persuasive tone 🗣️ | Model: llama3.1:latest

0:00 / 0:00

The <h1> to <h6> tags are used to define HTML headings.

Definition and Usage

  • The <h1> tag defines the most important heading.
  • The <h6> tag defines the least important heading.
  • Only use one <h1> per page, which should represent the main heading/subject for the whole page.
  • Do not skip heading levels; start with <h1>, then use <h2>, and so on.

Browser Support

| Element | Yes | No | | :--------- | --- | -- | |

-

| | |

The above table indicates that all modern browsers support the <h1> to <h6> elements.

Global Attributes

The <h1> to <h6> tags also support the Global Attributes in HTML.

Event Attributes

The <h1> to <h6> tags also support the Event Attributes in HTML.

More Examples

Example 1: Setting Background Color and Text Color of Headings (with CSS)

```html

Hello World

Hello World

```

Example 2: Setting Alignment of Headings (with CSS)

```html

This is heading 1

This is heading 2

This is heading 3

```

Default CSS Settings

Most browsers will display the <h1> element with the following default values:

css h1 { display: block; font-size: 2em; margin-top: 0.67em; margin-bottom: 0.67em; margin-left: 0; margin-right: 0; font-weight: bold; }

Similarly, the <h2> to <h6> elements have default values as follows:

```css h2 { display: block; font-size: 1.5em; margin-top: 0.83em; margin-bottom: 0.83em; margin-left: 0; margin-right: 0; font-weight: bold; }

/ ... /

h6 { display: block; font-size: 0.67em; margin-top: 2.33em; margin-bottom: 2.33em; margin-left: 0; margin-right: 0; font-weight: bold; } ```

Note that these default values may vary slightly across different browsers.

Related Pages



Sources:
- [HTML h1 to h6 tag - W3Schools] (https://www.w3schools.com/tags/tag_hn.asp)
- [

: The HTML Section Heading elements - MDN Web Docs] (https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/Heading_Elements)
- [What is an H1 Tag? Examples & SEO Best Practices - Moz] (https://moz.com/learn/seo/h1-tags)
- [HTML

-

Tags - W3docs] (https://www.w3docs.com/learn-html%20/html-h1-h6-tags.html)
- [HTML:

tag - TechOnTheNet] (https://www.techonthenet.com/html/elements/h1_tag.php)
- [What Is an H1 Tag? Why It Matters & Best Practices for SEO] (https://www.semrush.com/blog/h1-tag/?msockid=1e714b63100a63d10e4c5d0011ef62e9)
- [What is an H1 Tag? SEO Best Practices - Ahrefs] (https://ahrefs.com/blog/h1-tag/)
- [Header Tags: A Simple (But Complete) Guide To H1, H2 and H3 …] (https://seosherpa.com/header-tags/)
- [H1 Tags: What Are They, Best Practices, and Examples - Backlinko] (https://backlinko.com/h1-tag)
- [HTML

to

tags - Computer Hope] (https://www.computerhope.com/jargon/h/html-heading-tag.htm)