
Hyperlinks are what make the web a web. They connect pages, guide visitors through your content, help search engines discover new pages, and turn static documents into interactive experiences. Whether you are building your first web page or refining an existing site, understanding how to link a web page in HTML is a fundamental skill. The good news is that the core concept is simple: everything revolves around the anchor element. In this guide, you will learn the syntax, different types of links, useful attributes, and best practices for accessibility, security, and SEO.
Professional Web Development Support from AAMAX.CO
Linking pages is just one part of building a well-structured website. AAMAX.CO is a full-service digital marketing company offering web development, digital marketing, and SEO services worldwide. Their website development services include clean semantic HTML, thoughtful internal linking strategies, and navigation systems that improve both user experience and search visibility. Businesses that want a website built correctly from the ground up rely on them to handle the technical details while they focus on their goals.
The Basic Anchor Tag
In HTML, links are created with the anchor element, written as <a>. The href attribute specifies the destination, and the text between the opening and closing tags is what users click:
<a href="https://www.example.com">Visit Example</a>
When a visitor clicks "Visit Example," the browser navigates to the URL in the href attribute. This simple pattern is the foundation for every type of link on the web.
Absolute vs. Relative Links
Absolute Links
An absolute link includes the full URL, including protocol and domain. Use absolute links when pointing to other websites:
<a href="https://developer.mozilla.org/">MDN Web Docs</a>
Relative Links
A relative link points to a page within the same website, based on the current file's location. Relative links are shorter and keep working if your domain changes:
<a href="about.html">About Us</a>
<a href="blog/first-post.html">Read Our First Post</a>
<a href="../index.html">Back to Home</a>
A leading slash, such as /contact, creates a root-relative link that always starts from the website's root directory, which is a common and reliable choice for internal navigation.
Opening Links in a New Tab
To open a link in a new browser tab, add target="_blank". For security, also include rel="noopener noreferrer" to prevent the new page from accessing your page through the window object:
<a href="https://www.example.com" target="_blank" rel="noopener noreferrer">Open Example</a>
Use new tabs sparingly. Many users prefer to control this behavior themselves, so reserve it for external resources or situations where leaving the page would disrupt a task, such as filling out a form.
Linking to a Section on the Same Page
You can link to a specific section by giving the target element an id and referencing it with a hash symbol:
<a href="#pricing">Jump to Pricing</a>
<section id="pricing">
<h2>Pricing</h2>
</section>
This technique is ideal for tables of contents, long articles, and single-page websites. You can also link to a section on another page by combining a URL and a hash, such as /services#design.
Email and Phone Links
Special URL schemes allow links to open an email client or start a phone call:
<a href="mailto:hello@example.com">Email Us</a>
<a href="tel:+15551234567">Call Us</a>
Phone links are especially helpful on mobile devices, allowing visitors to call your business with a single tap.
Download Links
To prompt a file download instead of navigating to it, add the download attribute:
<a href="/files/brochure.pdf" download>Download Brochure</a>
Using Images as Links
Wrap an image inside an anchor element to make it clickable. Always include descriptive alt text so screen reader users know where the link goes:
<a href="/"><img src="/logo.png" alt="Company home page"></a>
Writing Accessible Link Text
Link text should clearly describe the destination. Avoid vague phrases like "click here" or "read more," which provide little context, especially for screen reader users who often navigate by links alone. Instead, write descriptive text such as "Read our web design pricing guide." Ensure links are visually distinguishable, for example with underlines or strong color contrast, and that they display a visible focus state for keyboard users.
SEO Best Practices for Links
- Use descriptive anchor text that includes relevant keywords naturally.
- Build strong internal linking so important pages receive links from related content.
- Fix broken links regularly to maintain user trust and crawl efficiency.
- Use rel attributes such as
nofolloworsponsoredfor paid or untrusted links. - Avoid excessive links on a single page, which can dilute value and overwhelm readers.
Styling Links with CSS
CSS lets you style links for different states: :link, :visited, :hover, :focus, and :active. Consistent link styling improves usability and reinforces your brand. Keep focus styles visible to support keyboard navigation.
Conclusion
Learning how to link a web page in HTML starts with the anchor tag and its href attribute. From there, you can create absolute and relative links, open pages in new tabs securely, jump to sections, trigger emails, phone calls, and downloads, and turn images into links. Follow accessibility, security, and SEO best practices, and your links will create a smooth, intuitive experience for both visitors and search engines.