HTML Headings
There 6 six headings in the HTML ,from <h1>
to <h6>
.These headings have different font size from each other ,the h1 is the largest heading and h6 is the smallest headings. This are used to define headings or title on a webpage.
<h1>
Main Heading
<h1>
is the most important heading in HTML. It represents the title of a webpage or section within it. Google and other search engines give high priority to <h1>
, and therefore, it is important for SEO (Search Engine Optimization). For the best SEO structure, only one <h1>
should be used per page.
EXAMPLE
Default Style: Bold and large (32px to 36px depending on the browser)
<h2>
Subheading
<h2>
is used for subheading under the main heading <h1>
.You can use it to define sections like "Introduction", "Benefits", "Examples", etc. So there is not limit for <h2>
tags and you can use multiple times on a page to divide the content.
EXAMPLE
Default Style: Smaller than <h1>
(24px to 30px)
<h3>
Sub-subheading
<h3>
is used inside the <h2>
section.When we create subsection in <h2>
so we used the <h3>
. It’s organizing detailed topic inside large sections. Best used when you need such content structure.
EXAMPLE
Default Style: Medium size (around 20px to 24px)
<h4>
Lower-Level Heading
<h4>
is Lower-Level Heading that can be used under <h3>
In HTML, <h4>
represents a heading, specifically the fourth level of heading. It is used to create subheadings within a webpage, providing further organization and structure to the content.
EXAMPLE
Default Style: Smaller than <h3>
(around 18px to 20px)
<h5>
Small Heading
<h5>
is rarely used but also used for footnotes,side notes,or small group titles.
EXAMPLE
Default Style: Quite small (around 16px)
<h6>
Smallest Heading
<h6>
is the smallest heading and it rarely used.It used for minor content.
EXAMPLE
Default Style: Very small (around 12px to 14px)
HTML Online Editor
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>This is Heading 1</h1>
<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>
</body>
</html>
Paragraph Tag
<p>
tag in HTML stand for paragraph.It serves the purpose of establishing a separate block of text as a paragraph; It is the simplest and frequently used element for adding content in a webpage.
- Organizes text into sections that can be read easily.
- Automatically adds space (margin) before and after the text.
- Help in Search Engine Optimization (SEO) by organizing the content appropriately.
EXAMPLE
Line Break Tag
The <br>
In HTML, "line break" is represented by the
tag. When you want the text to begin on a new line without beginning a new paragraph, you use this technique. This is particularly useful when writing poetry, addresses, or any other type of content where manually breaking the line enhances readability.
Features of <br>
Tag
- Inline Tag:It just breaks the line there; unlike a paragraph, it doesn't add extra space.
- Self-closing: A closing tag is not necessary (
</br>
is incorrect). - No additional margin: It doesn't add space before or after like
does.
- Note: The
<br>
is empty tag and does not need a closing tag.
Don't use <br>
too much for layout. Use it only when a line break is necessary to convey the meaning of the content.
Use semantic tags such as <p>
, <h1>
–<h6>
, <ul>
, and others to organize content
for improved SEO and accessibility.
Center Tag
In HTML the <center>
is used to center the content like text,image or other element on a webpage.The <center>
tag is deprecated in HTML5. This means their is no longer recommended and should not be used in modern website.
Modern Method (Recommended)
Horizonal Rule Tag
In HTML, a horizontal line is created across the webpage using the <hr>
(horizontal rule) tag. It is frequently used to visually divide sections or content.The<hr>
tag is empty tage and does not need a closing tag.The<hr>
is regarded as semantic in modern HTML (HTML5), meaning:It is not just line but it signifies a break in the section or topic.The content before and after this line are different in meaning or purpose.
EXAMPLE
<hr>
Preformatted text
The <pre>
tag is represented the preformatted text and used in HTML to display the text exactly as in typed in the HTML document, including line breaks, tabs, and spaces. The <pre>
tag is the best option if you want the content to show up on the page with the same spacing and layout as it does in your HTML file. When displaying source code or any other text where the original formatting—like indentation and line structure is crucial, it's extremely helpful. Because <pre>
doesn't compress white space like other tags do, you have complete control over how your text appears.