Back to HTML Notes
Topic #114

Internal Links

Learn how to create internal links using anchor tags and IDs, ensuring users can navigate your site seamlessly while helping search engines understand your content structure.

What it is

An internal link connects one page of your website to another page within the same domain. Unlike external links that point to other websites, internal links keep visitors engaged with your content. The primary mechanism for this is the <a> (anchor) tag combined with the href attribute pointing to a relative URL or an ID fragment.

The mental model is simple: think of your website as a web of interconnected nodes. Internal links are the threads connecting these nodes. Key related terms include "anchor text" (the clickable words), "target page," and "orphan pages" (pages with no incoming internal links).

Why it matters

  • User Experience: Helps readers find related information without searching or navigating menus manually.
  • SEO Authority Distribution: Search engines use links to determine which pages are most important; linking from high-authority pages boosts linked pages.
  • Crawlability: Ensures search engine bots discover all pages on your site, preventing "orphan pages" from being ignored.
  • Dwell Time: Encourages users to stay longer on your site by providing logical next steps.

Syntax or steps

To link to another page on your site, use the <a> tag with a relative path in the href. To link to a specific section on the current page, use an ID.

  1. Identify the target page or section.
  2. If targeting a section, add an id attribute to the heading or container element.
  3. Create an anchor tag where the href starts with # followed by the ID name.
  4. For different pages, set the href to the file path (e.g., /about.html).

Example

<!DOCTYPE html>
<html lang="en">
<head>
    <title>Internal Linking Demo</title>
</head>
<body>
    <nav>
        <!-- Link to another page -->
        <a href="/contact.html">Contact Us</a>
    </nav>

    <main>
        <h1 id="top">Welcome to Our Site</h1>
        <p>This is the introduction.</p>
        
        <!-- Link to a specific section on this page -->
        <a href="#services">Jump to Services</a>

        <section id="services">
            <h2>Our Services</h2>
            <p>We offer great services.</p>
            
            <!-- Back to top link -->
            <a href="#top">Back to Top</a>
        </section>
    </main>
</body>
</html>

Explanation: The first link uses href="/contact.html" to navigate away from the current page. The second link uses href="#services", which matches the id="services" on the section below, causing the browser to scroll to that element instantly. The final link returns the user to the top using href="#top".

Common mistakes

  • Broken Links: Using incorrect paths (e.g., missing slashes). Always test links after deployment.
  • Generic Anchor Text: Using "click here" instead of descriptive text like "read our pricing guide." Descriptive text helps SEO and accessibility.
  • Orphan Pages: Creating new pages but forgetting to link to them from existing content. Every page should have at least one incoming internal link.
  • Deep Nesting: Requiring too many clicks to reach important content. Keep critical pages within 3 clicks of the homepage.

When to use it

Link Type Use Case Best For
Internal Link Navigating within your own domain SEO, User Retention, Site Structure
External Link Referencing outside sources Credibility, Citations, Partnerships

Use internal links for navigation and authority flow. Use external links sparingly when citing facts or directing users to third-party tools.

Practice

Guided Exercise: Create two HTML files, index.html and about.html. Add a link in index.html that goes to about.html, and a link in about.html that returns to index.html.

Challenge: In index.html, add three sections with unique IDs. Create a table of contents at the top that links to each section using fragments (#id).

Quick check

Question: What happens if you link to an ID that does not exist on the page?

Answer: The browser will typically do nothing or remain at the current scroll position, as there is no matching element to jump to. It does not cause a page error, but the navigation fails.

Summary

Internal links are essential for guiding users and distributing SEO value across your website. By using relative paths for pages and ID fragments for sections, you create a cohesive, navigable site structure that prevents orphan pages and improves engagement.

Want to go beyond the notes?

Join Coding Now Tech Institute's HTML course — live mentorship, real projects, and 100% placement support.

Enroll Now — Free Demo Available

Internal Links – FAQs

Quick answers about learning Internal Links in HTML.

This free note from Coding Now Tech Institute explains Internal Links in HTML — concept, syntax and worked code examples you can copy, run and revise before interviews.
Yes. Every HTML topic on Coding Now Tech Institute, including Internal Links, is 100% free with no signup required.
With focused practice, most students grasp Internal Links in 1–3 days from these notes; pairing it with Coding Now Tech Institute's mentor-led course takes you to job-ready depth faster.
Use the code examples in this note, then ask doubts for free on the Coding Now Tech Institute Community (/community) — expert instructors answer within 24 hours.
Call NowEnroll Now