Definition and Usage
The <h1>
to <h6>
tags are used to define HTML headings. The h1
tag defines the most important heading, while the h6
tag defines the least important heading.
Example
```html
Hello World
Hello
```
Try it Yourself ยป Complete HTML Reference
Complete HTML Reference
- HTML Headings
- Definition and Usage
- Example
- Try it Yourself ยป
- Related Pages
- HTML tutorial: HTML Headings
- HTML DOM reference: Heading Object
- Default CSS Settings
-
- Yes
- Yes
- Yes
- Yes
- Global Attributes
- Event Attributes
- More Examples
Related Pages
HTML tutorial: HTML Headings
The h
element represents a heading, which is a level of importance in a document. The value of the h1
element through h6
elements must be unique within each document.
HTML DOM reference: Heading Object
The Heading
object returns information about an element on a web page.
Default CSS Settings
The browser displays the h1
element with default values:
| Property | Value |
| --- | --- |
| display | block |
| font-size | 2em |
| margin-top | 0.67em|
| margin-bottom| 0.67em|
| margin-left | 0 |
| margin-right| 0 |
| font-weight| bold |
Try it Yourself ยป Default CSS Settings
Try it Yourself
Example
```html
Hello World
```
This sets the background color of h1
elements to Dodger Blue.
Try it Yourself ยป
You can try setting different styles for your headings using the CSS styles attribute. For example:
css
h2 {
color: Tomato;
}
This sets the text color of h2
elements to Tomato.
Try it Yourself ยป Complete HTML Reference
Complete HTML Reference
- HTML Headings
- Definition and Usage
- Example
- Try it Yourself ยป
- Related Pages
- HTML tutorial: HTML Headings
- HTML DOM reference: Heading Object
- Default CSS Settings
Definition and Usage
The <h1>
to <h6>
tags are used to define HTML headings. The h1
tag defines the most important heading, while the h6
tag defines the least important heading.
Example
```html
Hello World
Hello
```
Try it Yourself ยป Complete HTML Reference
Try it Yourself ยป
You can try setting different styles for your headings using the CSS styles attribute. For example:
css
h2 {
color: Tomato;
}
This sets the text color of h2
elements to Tomato.
Try it Yourself ยป Complete HTML Reference
Complete HTML Reference
- HTML Headings
- Definition and Usage
- Example
- Try it Yourself ยป
- Related Pages
- HTML tutorial: HTML Headings
- HTML DOM reference: Heading Object
- Default CSS Settings
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)