Headings, Paragraphs & Text Formatting
1. Simple Definition
Text ko organize karne ke liye HTML hume 6 levels ki headings (<h1> se <h6>), regular paragraphs (<p>), aur semantic text formatting tags (jaise <strong>, <em>, <mark>) provide karta hai.
2. Real-Life Analogy
Newspaper me sabse badi front headline H1 hoti hai. Sub-news H2 ya H3 hoti hain, aur detailed khabar paragraph (P) me hoti hai. Important shabdon ko highlighter se mark kiya jata hai (mark) ya bold kiya jata hai (strong).
3. Why Do We Need It?
Agar saara text ek hi size me likha ho toh koi bhi user article nahi padhega. Proper heading hierarchy se user aur Google dono samajhte hain ki sabse zaroori topic kaunsa hai.
4. Syntax
<h1>Sabse Badi Main Heading</h1>
<h2>Sub Heading Level 2</h2>
<p>Regular paragraph jisme <strong>bold text</strong> aur <em>italic text</em> ho sakta hai.</p>
<hr> <!-- Horizontal divider line -->
<br> <!-- Line break -->
5. Basic Example
<article>
<h1>Web Development Kaise Shuru Karein?</h1>
<h2>Pehla Step: HTML Seekhein</h2>
<p>HTML seekhna <strong>bahut aasan</strong> hai. Isme <mark>zero coding experience</mark> chahiye hota hai.</p>
<hr>
<p>Aapko roz sirf <em>1 ghanta</em> practice karni hai.<br>Consistency hi success ki key hai.</p>
</article>
6. Output / Expected Result
Web Development Kaise Shuru Karein?
Pehla Step: HTML Seekhein
HTML seekhna bahut aasan hai. Isme zero coding experience chahiye hota hai.
Aapko roz sirf 1 ghanta practice karni hai.
Consistency hi success ki key hai.
7. Code Explanation
<h1>: Page ka primary topic. Ek page par ideally sirf ek hi<h1>hona chahiye.<strong>: Sirf bold nahi karta, balki screen readers ko batata hai ki ye shabd urgent/important hai.<em>: Text ko italic karke emphasis (zor) deta hai.<mark>: Text par yellow highlighter effect deta hai.<br>: Nayi line shuru karta hai bina naya paragraph banaye (Self-closing).<hr>: Topic change hone par beech me horizontal divider line banata hai.
8. Real-World Example
Wikipedia ya Medium ke kisi bhi blog post par heading hierarchy aur highlighted terms isi tarah design kiye jaate hain.
9. Common Mistakes
Headings ko font-size bada karne ke liye use mat kijiye (uske liye CSS hai). Headings ko document ki hierarchy aur meaning dikhane ke liye use karein.
H1 ke direct baad H4 par jump mat kijiye. H1 -> H2 -> H3 ka natural step follow karein.
10. Best Practices
- Pure webpage par sirf 1 main
<h1>rakhein (SEO best practice). - Pure paragraph ke beech line break ke liye
<p>use karein, 10 baar<br><br>mat lagayein. - HTML comments
<!-- Comment -->use karein apne code ko explain karne ke liye.
11. Try It Yourself
Playground me ek news report likhein jisme H1, H2, do paragraphs, strong aur mark tags shamil hon.
12. Challenge
Ek mini biography page banayein jisme aapke favorite sportsperson ki headline, unke records aur unka ek famous quote <blockquote> me ho.
13. Interview Questions
Answer: <b> aur <i> purely visual tags hain bina kisi extra meaning ke. Jabki <strong> aur <em> semantic tags hain jo screen readers aur search engines ko importance aur voice tone indicate karte hain.
14. Quick Revision
- H1 se H6 headings hierarchy banate hain.
- Paragraphs text content organize karte hain.
- Comments
<!-- ... -->browser me render nahi hote.
15. FAQ
Q1. Kya H7 tag hota hai?
Nahi! HTML me sirf H1 se H6 tak hi headings hoti hain.
Q2. HTML comment kaise likhte hain?
<!-- Ye comment hai -->. Ye browser me nahi dikhta, sirf developers ke padhne ke liye hota hai.
Q3. Kya <br> tag ko close karna zaroori hai?
HTML5 me <br> self-closing void tag hai. Isme </br> likhna galat hai.
Q4. Code snippet text me kaise dikhayein?
HTML me <code> tag use kiya jata hai mono-spaced code font ke liye.
Q5. Preformatted text ke liye kaunsa tag hai?
<pre> tag spaces aur new lines ko jaisa hai waise hi preserve karta hai.
Headings, Paragraphs & Text Formatting
1. Simple Definition
Typography and text elements form the core readability of any web document. Headings range from <h1> (primary title) down to <h6> (minor sub-heading). Paragraphs are defined with <p>, and semantic formatting tags like <strong> and <em> convey importance and emphasis.
2. Real-Life Analogy
Pick up any newspaper: The massive headline at the very top is <h1>. Section titles (Sports, Economy) are <h2>, and individual article titles are <h3>. The body copy is written in flowing paragraphs (<p>) with critical terms highlighted in bold.
3. Why Do We Need It?
- Information Architecture: Screen readers use heading levels to let visually impaired users jump directly to specific sections.
- SEO Ranking: Search engines heavily weigh
<h1>and<h2>tags when indexing core page topics. - Visual Scannability: Web users do not read word-for-word; they scan clear visual hierarchies.
4. Syntax
<h1>Primary Document Heading</h1>
<h2>Secondary Section Title</h2>
<p>This is a standard paragraph with <strong>bold importance</strong> and <em>italic emphasis</em>.</p>
5. Basic Example
<article>
<h1>Mastering Modern Frontend Engineering</h1>
<p>Building websites today requires <strong>semantic HTML5</strong> and responsive design.</p>
<h2>Core Technologies</h2>
<p>You will master <mark>HTML, CSS, and JavaScript</mark> through hands-on practice.</p>
<hr>
<p><small>Published by WebDev Hinglish • Updated for 2026</small></p>
</article>
6. Output / Expected Result
Mastering Modern Frontend Engineering
Building websites today requires semantic HTML5 and responsive design.
Core Technologies
You will master HTML, CSS, and JavaScript through hands-on practice.
Published by WebDev Hinglish • Updated for 2026
7. Code Explanation
<h1> - <h6>: Block-level heading elements. Best practice dictates using exactly one<h1>per document.<p>: Block-level paragraph container with standard browser vertical margin spacing.<strong> vs <b>:<strong>carries semantic importance (audible in screen readers);<b>is merely cosmetic bolding.<em> vs <i>:<em>represents stressed verbal emphasis;<i>is styling for alternate voice (technical terms, book titles).<hr>: Represents a semantic thematic break between topics.
8. Real-World Example
In technical documentation sites like MDN or Stripe Docs, the page title is always <h1>, section titles are <h2>, and sub-arguments are <h3>. Skipping heading levels (e.g. going from h1 directly to h4) breaks navigation for assistive screen reader users.
9. Common Mistakes (Beginners Traps)
Never pick an <h4> just because you want small text. Choose headings strictly by document outline hierarchy, and resize typography using CSS font-size.
Having multiple <h1> tags confuses search engine algorithms regarding the primary theme of the URL.
10. Best Practices
- Maintain a strict heading hierarchy:
h1 → h2 → h3without skipping levels. - Use
<strong>and<em>for semantic meaning rather than purely visual<b>and<i>. - Use
<br>exclusively for line breaks within poems or postal addresses, never for visual margin spacing.
11. Try It Yourself
Open the Live Playground and construct a mini article with an h1, two h2 sections, and formatted paragraphs!
12. Mini Challenge
Create an author profile section featuring an h2 name, a paragraph with highlighted text (<mark>), and a small disclaimer paragraph.
13. Interview Questions
Answer: <strong> has semantic significance and alerts screen readers to emphasize speech pitch. <b> is presentational and conveys no accessibility meaning.
Answer: Screen reader navigation shortcuts allow users to cycle between headings. Gaps in the heading hierarchy create confusion, suggesting missing content.
14. Quick Revision
- Headings dictate document hierarchy; CSS controls visual font sizes.
- Only use one
<h1>per web page. - Semantic tags enhance accessibility, SEO, and developer readability.
15. FAQ (Frequently Asked Questions)
Q1. Can a paragraph <p> contain another block element like <div>?
No. Browsers will automatically close the paragraph before rendering the child block element, resulting in broken DOM structures.
Q2. What is the modern tag for deleted or superseded text?
Use <del> for deleted text and <ins> for newly inserted text (common in changelogs and discounts).