What Are H1 To H6 Tags In HTML?
Headings are represented in HTML using heading elements. These range from h1-h6. Each heading is bold and has a different font size starting from h1 being the largest and h6 being the smallest.
Headings are used to separate portions of a webpage to improve navigation for the user. Headings of various fonts can allow us to use different headings for components such as titles, subtitles, sub-headings, and captions.
Syntax
The syntax of the heading elements is as follows:
<h1> This is Heading 1 </h1>We begin by opening the tags using the <> sign. In between, we write the name of the element. It can range from h1 to h6 in our case. We then close the tags by using the </> sign. Once again, we will place the name of our tag in between <> and after the / symbol. Any text written between these tags will appear as a heading. All other heading elements can be written in a similar manner:
<h2> This is Heading 2 </h2> <h3> This is Heading 3 </h3> <h4> This is Heading 4 </h4> <h5> This is Heading 5 </h5> <h6> This is Heading 6 </h6>Example
The following code snippet outputs each of the headings:
- HTML
We can also use CSS within the heading tags in order to style each heading. The syntax below shows how it can be done:
<h1> Heading </h1>Inside the heading tags, we can add the style command that allows an attribute and its value.
Attributes refer to characteristics of the heading. These include background-color, color, text-align font-size etc.
A value is assigned to each attribute.
The code snippet below style each heading differently:
background-color changes the background color of the heading.
text-align positions the heading to either right, left, or center of the screen (as specified).
color changes the font color of the heading.
- HTML
Relevant Answers
Explore Courses
Free Resources
Copyright ©2025 Educative, Inc. All rights reservedTừ khóa » H1 Vs H6 Html
-
HTML H1 To H6 Tag - W3Schools
-
–
: The HTML Section Heading Elements - MDN - Mozilla
-
HTML: The H1 To H6 Tags - Khan Academy
-
H1-H6 Heading Tags And SEO: The Ultimate Guide - ContentKing
-
H1, H2, H3, H4, H5, H6 HTML - W3schools.blog
-
Importance Of HTML Headings: H1 To H6 - Tutorial Republic
-
How To Use The H1 To H6 Headings - SISTRIX
-
HTML -
To
Tag - Tutorialspoint
-
HTML Heading Tags: The SEO Guide For H1 - H6 - SE Ranking
-
Headings
-
Header Tags: A Simple (But Complete) Guide To H1, H2 And H3 Tags
-
Heading Tags SEO: Tips For Using H1 To H6 Right Way - ShoutMeLoud
-
HTML Heading - H1 To H6 Tags In HTML - DataFlair
-
HTML - Heading Elements H1, H2, H3, H4, H5 And H6.