Text Formatting, Headings, & Hyperlinks
Every webpage is fundamentally a hyperlinked text document. When you read a blog post, news report, or documentation page, your eyes rely on visual hierarchy—clear titles, structured paragraphs, emphasized phrases, and clickable links that transport you across cyberspace.
In this chapter, you will learn how to structure written content hierarchically and connect web documents using hyperlinks.
1. Headings Hierarchy: <h1> to <h6>
HTML provides six levels of section headings: <h1> represents the highest importance, and <h6> represents the lowest.
<h1>Main Page Title (Thinkora Web Development)</h1><h2>Chapter 2: Text and Headings</h2><h3>Section 2.1: Heading Levels</h3><h4>Subsection: Micro Details</h4><h5>Minor Notice</h5><h6>Fine Print Reference</h6>Golden Rules of Heading Architecture
- Only One
<h1>Per Page: Think of<h1>like the title of a book. Search engines (like Google) and screen readers treat the<h1>as the primary topic of the document. - Never Skip Heading Levels for Font Size: Do not jump from
<h2>directly down to<h4>just because you want smaller text. Use CSS to adjust font sizes; maintain logical semantic levels (h1h2h3) for accessibility. - Screen Reader Navigation: Visually impaired users using screen readers (such as NVDA or VoiceOver) frequently press the
Hkey to skim through headings like an interactive table of contents.
Document Outline:
└── <h1> Modern Web Development
├── <h2> Chapter 1: Introduction to HTML
│ ├── <h3> Tag Anatomy
│ └── <h3> HTML5 Skeleton
└── <h2> Chapter 2: Headings & Links
├── <h3> Heading Hierarchy
└── <h3> Anchor Links
2. Paragraphs & Whitespace Collapsing
The <p> tag defines a paragraph of text. Browsers automatically add vertical margins before and after each paragraph.
<p> Welcome to Thinkora! In this lesson, Rahul and Priya are learning how browsers render text and links.</p><p> This is a separate paragraph with its own natural vertical breathing room.</p>HTML Whitespace Collapsing
In HTML, consecutive spaces, tabs, and newlines in your source code are collapsed into a single space:
<!-- What you type: --><p> Hello world! This is on a new line in my code editor.</p><!-- What the browser renders: --><!-- "Hello world! This is on a new line in my code editor." -->If you need an explicit line break without starting a new paragraph, use the void <br> tag:
<p> Thinkora Academy<br> Connaught Place, New Delhi<br> India</p>[!WARNING] Use
<br>sparingly (e.g. for postal addresses or poetry). Never use multiple<br><br><br>tags to push elements down on the page; always use CSS margins or padding for layout spacing!
3. Inline Text Formatting Tags
HTML includes dedicated tags to assign semantic emphasis and styling to specific words inside a paragraph:
| Tag | Name | Browser Default | Semantic Meaning |
|---|---|---|---|
<strong> | Strong Importance | Bold | Serious importance or urgency (announced with emphasis by screen readers). |
<em> | Stress Emphasis | Italics | Stressed pronunciation (changes the sentence's meaning or tone). |
<b> | Bring Attention | Bold | Stylistic bolding without extra semantic importance (e.g. product keywords). |
<i> | Idiomatic Text | Italics | Alternate voice, foreign phrases, technical terms, or thoughts. |
<code> | Inline Code | Monospace | Computer code snippets, keyboard shortcuts, or variables. |
<mark> | Highlighted Text | Yellow bg | Text highlighted for relevance or search result matches. |
<del> | Deleted Text | Content that has been removed or superseded (e.g. old price). | |
<ins> | Inserted Text | Underline | Content added to update a document. |
<small> | Side Comment | Smaller font | Fine print, disclaimers, copyrights, or legal attribution. |
Practical Example
<p> Special Offer: Originally <del>₹1,999</del>, now only <mark><strong>₹999</strong></mark>! Use coupon code <code>THINKORA2026</code> at checkout.</p><p> <small>© 2026 Thinkora Inc. All rights reserved.</small></p>4. Hyperlinks: The <a> Anchor Element
The <a> (anchor) tag is the defining feature of the World Wide Web—it turns plain documents into interconnected hypertext.
<a href="https://example.com">Visit Example Website</a>The most crucial attribute is href (Hypertext Reference), which points to the target destination.
Absolute vs. Relative URLs
URL Types
│
┌────────────┴────────────┐
▼ ▼
Absolute URL Relative URL
Points to external site Points to file on same server
e.g. https://google.com e.g. /about or ./contact.html
Absolute URLs: Include the full protocol and domain name. Use these when linking to external websites:
<a href="https://github.com">Explore GitHub</a>Relative URLs: Point to pages within your own website project without repeating the domain:
<!-- Link to a page in the same folder --><a href="about.html">About Us</a><!-- Link to a page in a subfolder --><a href="courses/web-dev.html">Web Dev Course</a><!-- Link to root of site --><a href="/dashboard">Go to Dashboard</a>
5. Advanced Anchor Attributes
Opening in a New Tab: target="_blank"
By default, clicking a link navigates away from the current page in the same tab. If you want the link to open in a fresh browser tab, set target="_blank":
<a href="https://developer.mozilla.org" target="_blank" rel="noopener noreferrer"> Read MDN Docs (opens in new tab)</a>[!IMPORTANT] Whenever you use
target="_blank", always addrel="noopener noreferrer". This security best practice prevents the newly opened page from accessing yourwindow.openerobject via JavaScript (a vulnerability known as reverse tabnabbing).
In-Page Jump Links (Fragment Identifiers)
You can link to specific sections on the same page by referencing the target element's id:
<!-- 1. Table of Contents link --><a href="#pricing-section">Jump to Pricing Plans</a><!-- Lots of content here... --><!-- 2. Target element with matching id --><section id="pricing-section"> <h2>Our Pricing Plans</h2> <p>Choose the plan that fits your learning journey.</p></section>Email and Telephone Links
Anchors can also trigger email clients and phone dialers using special URL protocols:
<!-- Email link --><a href="mailto:support@thinkora.com?subject=Help%20Request">Email Support</a><!-- Phone call link (tappable on mobile devices) --><a href="tel:+919876543210">Call Customer Service</a>6. Flashcards
Why should an HTML page typically contain only one <h1> heading?
represents the primary topic of the page for search engine crawlers (SEO) and screen reader users navigating document outlines.
What happens to multiple spaces and line breaks inside standard HTML paragraphs?
Why must you pair target='_blank' with rel='noopener noreferrer'?