What is HTML Elements ?
HTML provides many tags to organize, structure, and format text on a web page. Let’s go through them one by one.
Headings (<h1>
to <h6>
)
- Headings are used to define titles and subtitles in a web page.
- There are 6 levels of headings in HTML:
<h1>
→ Main heading (largest, most important).<h6>
→ Smallest heading (least important).
Example:
<h1>This is a Main Heading.</h1>
<h2>This is a Sub Heading.</h2>
<h3>This is a Section Heading.</h3>
<h4>This is a Smaller Heading.</h4>
<h5>This is an Even Smaller Heading.</h5>
<h6>This is the Smallest Heading.</h6>
Output :
Note: Use <h1>only once on a page (for the main title). Others can be repeated.
Paragraphs (<p>
)
- Paragraphs are used to write blocks of text.
- Browsers automatically add space before and after a paragraph.
- Each
<p>
is displayed on a new line.
Example:
<p>This is the first paragraph of text.</p>
<p>This is another paragraph of text.</p>
Output :
Line Breaks & Horizontal Rules (<br>
, <hr>
)
Line Break (<br>
)
- Adds a line break inside text (without starting a new paragraph).
- Useful for poems, addresses, or where text must continue on the next line.
Example:
<p>My address:<br>
123 Street Name<br>
City, Country</p>
Output :
Horizontal Rule (<hr>
)
- Creates a horizontal line across the page.
- Used to separate sections of content.
Example:
<p>Introduction section ends here.</p>
<hr>
<p>Next section starts below this line.</p>
Output :