Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
accessibility

How to Link to Another Page in HTML: A Complete Guide to href, Paths, Sections, and Accessible Link Text

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use an anchor element with an href attribute: <a href="about.html">About this site</a>. The href value identifies the destination, and the text between the tags is the visible, clickable label. Use a relative path for a page in your own site or a full URL for an external page, and make sure the path resolves from the document containing the link.

The basic link syntax

An HTML link is an <a> (anchor) element with an href attribute:

<a href="about.html">About this site</a>

In this example, about.html is the destination and About this site is the link text. A browser renders the text as a hyperlink. The HTML Living Standard defines an anchor with href as a hyperlink labeled by its contents; see the WHATWG HTML Living Standard.

A complete two-page example

Put these files in the same folder:

<!-- index.html -->
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Home</title>
</head>
<body>
  <h1>Home</h1>
  <p>Read <a href="about.html">our organization</a>.</p>
</body>
</html>

<!-- about.html -->
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>About</title>
</head>
<body>
  <h1>About our organization</h1>
</body>
</html>

Open index.html in a browser and select the link. Because both files are siblings, the short relative path resolves to about.html.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
HTML and CSS: Design and Build Websites
  • HTML CSS Design and Build Web Sites
  • Comes with secure packaging
  • It can be a gift option

Choose the right href value

Relative links to pages in your site

A relative URL is interpreted from the location of the current HTML document. Use it when the target is part of the same site or project.

Current file Target file href
index.html about.html in the same folder about.html
blog/index.html blog/contact.html contact.html
blog/index.html about.html one folder up ../about.html
docs/start.html images/logo.png under the site root Path depends on the document’s folder; for a file one level up, use ../images/logo.png

.. means “parent folder.” Count directory levels from the current file and use forward slashes, including on Windows-hosted projects. A path that works in one folder may fail after moving the page, so verify it in the deployed site as well as locally.

Root-relative links

On a web server, a path beginning with / starts at that site’s root:

<a href="/about.html">About this site</a>

This is useful when pages live at different directory depths, but it assumes the site is served from the domain root. On a project hosted under a subdirectory, such as example.com/my-site/, a root-relative path may point to the wrong location.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Absolute links to another website

Use the complete URL, including the scheme, for an external destination:

<a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/a">MDN's anchor reference</a>

Use https:// where the destination supports it. The browser then requests that exact URL rather than resolving a file relative to the current page.

Link to a section on the same page

Give the destination element a unique id, then use that value after # in the link:

<p><a href="#contact">Go to the contact section</a></p>

<h2 id="contact">Contact</h2>
<p>Send questions to our team.</p>

The fragment identifier is not sent as part of the server request; the browser uses it to locate the element with the matching ID. IDs must be unique within the document and should not contain spaces. The MDN anchor reference demonstrates this pattern.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

You can combine a page URL and a fragment to open a section on another page:

<a href="guide.html#installation">Read the installation section</a>

The target page must contain an element such as <h2 id="installation">Installation</h2>.

Write link text people can understand

Make the words inside the anchor describe the destination or action. Users often scan links out of context, and screen readers can present a list of links without the surrounding paragraph.

  • Descriptive: <a href="pricing.html">View current pricing</a>
  • Weak: <a href="pricing.html">Click here</a>
  • Better in a sentence: Compare the plans on our <a href="pricing.html">current pricing page</a>.

The W3C WAI H30 technique explains that descriptive anchor text helps users determine a link’s purpose. Avoid repeating the same vague label for different destinations. If several links go to different pages, each label should distinguish its target.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Links that download files

If selecting a link downloads a file rather than displaying a page, say so in the label when that behavior may surprise users:

<a href="reports/annual-report.pdf">Download the annual report (PDF)</a>

The browser may display a PDF or download it according to server headers and user settings. The label tells the user what to expect without relying on an icon alone.

Links that open a new tab

Normal navigation should open in the current tab. If a genuine requirement calls for a new tab, communicate it:

Rank #4
Sale
Web Design with HTML, CSS, JavaScript and jQuery Set
  • Brand: Wiley
  • Set of 2 Volumes
  • A handy two-book set that uniquely combines related technologies Highly visual format and accessible language makes these books highly effective learning tools Perfect for beginning web designers and front-end developers
<a href="https://example.com" target="_blank">Partner documentation (opens in a new tab)</a>

Unexpected new tabs can be confusing. MDN recommends indicating this behavior in the text or another accessible indicator; see its anchor documentation. Do not add target="_blank" simply because it is common—let the user choose whether to open a link in another tab.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use an anchor for navigation, not a fake button

An anchor with an actual destination is for navigation. Do not use href="#" or href="javascript:void(0)" as a substitute for a button:

<!-- Navigation -->
<a href="settings.html">Open settings</a>

<!-- An action that does not navigate -->
<button type="button" id="save-button">Save changes</button>

A fake link can jump the page to the top, behave unexpectedly when copied or bookmarked, and fail when JavaScript is disabled. Use a <button> for actions such as opening a dialog, toggling a menu, submitting an operation, or saving data. MDN documents these pitfalls in its anchor reference.

Common path problems and fixes

“404 Not Found” after clicking

  • Check spelling, capitalization, and the file extension. Many production servers treat About.html and about.html as different files.
  • Resolve the path from the folder containing the current document, not from the project folder you have open in your editor.
  • Confirm the target file was uploaded and that the server’s route really exists.

The link works locally but not after deployment

  • Check whether the site is hosted below the domain root; change a root-relative path such as /about.html to the correct subdirectory path if necessary.
  • Ensure your host supports the extension and route you used. A static file path and a framework route are not always interchangeable.
  • Test the final, deployed URL directly, then test the link from each page depth.

The page opens, but not at the intended section

  • Make sure the target element has the exact matching id, including capitalization.
  • Remove duplicate IDs. The browser cannot provide a reliable target when multiple elements share one.
  • Confirm the fragment is attached after the page URL, for example guide.html#installation.

The link is hard to understand with a screen reader

Replace labels such as “here,” “more,” or repeated “read this” text with the destination or purpose. Keep visible wording concise, but specific enough to make sense when read alone. Decorative images used as links need meaningful alternative text so their destination is also clear.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

A practical testing checklist

  1. Open the source page and inspect the rendered link.
  2. Verify the href spelling and resolve each path from the source file’s directory.
  3. Select the link with a mouse, keyboard, and touch device.
  4. Confirm the destination title or heading matches what the link promised.
  5. Test direct and deployed URLs, including pages nested in subfolders.
  6. For fragments, confirm the intended element has one unique id.
  7. Check that download and new-tab behavior is announced when applicable.
  8. Read the link labels out of context to check that they remain descriptive.

Or skip the browser setup

If your goal is to capture a linked page rather than build navigation, ScreenshotNeo provides a website screenshot API and MCP server. It accepts consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status. AI agents can use its MCP tools—take_screenshot, get_page_info, and capture_pdf.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

One GET request returns an image or PDF:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

See the ScreenshotNeo documentation for authentication and options. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 screenshots. Create a free ScreenshotNeo account.

FAQ

Can I put HTML tags inside an anchor?

Yes. An anchor can contain phrasing content such as text and an image, provided the resulting interactive content is valid for your document. Keep the accessible name clear.

Should every link use a full URL?

No. Relative URLs are usually simpler for pages within the same site; full URLs are appropriate for external destinations. The correct choice depends on where the target is hosted and how your site is deployed.

Why does my link show as plain text?

Check that the opening tag includes href, the quotation marks are balanced, and the closing </a> appears after the intended label. Invalid surrounding markup can also change how the browser parses the element.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Frequently Asked Questions

Can an HTML link open an email address?

Yes. Use a mailto URL, such as <a href="mailto:[email protected]">Email our team</a>. Warn users when selecting it will launch an email application.

How do I link to a phone number?

Use a telephone URL on supported devices: <a href="tel:+15551234567">Call +1 555 123 4567</a>. Display the number so users can verify what will be dialed.

Is an HTML link the same as a hyperlink?

In ordinary web usage, yes: an anchor with an href creates a hyperlink to another resource or document location.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Read next

Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.