Headings, Paragraphs & Comments in HTML
HTML provides basic elements to structure your content clearly on a webpage. Three of the most commonly used elements are headings, paragraphs, and comments. These elements help organize text, improve readability, and make your code easier to understand.
1. Headings in HTML
Headings are used to define titles and subtitles in a webpage.
✔ Types of Headings
HTML has six levels of headings, from <h1> to <h6>:
-
<h1>→ Main title (largest) -
<h2>→ Sub-title -
<h3>→ Section heading -
<h4>→ Sub-section heading -
<h5>→ Smaller-level heading -
<h6>→ Smallest heading
✔ Example:
2. Paragraphs in HTML
Paragraphs are used to display blocks of text.
You can create a paragraph using the <p> tag.
✔ Example:
Paragraphs automatically add spacing before and after themselves.
3. HTML Comments
Comments are notes you add inside HTML code.
They are ignored by the browser and do not appear on the webpage.
They help you and other developers understand the code later.
