
Hyperlinks are what make the web a web. They connect pages, guide visitors through content, and help search engines discover and understand websites. Whether you are building your first website or refining an existing one, knowing how to link a web page in HTML is a fundamental skill. HTML uses the anchor element to create links, and while the basic syntax is simple, there are several variations and best practices that improve usability, accessibility, and SEO. This guide explains everything you need to know about creating links in HTML.
Professional Web Builds with AAMAX.CO
Understanding HTML links is essential, but building a complete, well-structured website involves much more. AAMAX.CO is a full-service digital marketing company offering web development, digital marketing, and SEO services worldwide. Their developers write clean, semantic HTML with logical internal linking structures that improve navigation and search engine visibility. Businesses that want a website built on solid technical foundations can rely on them to handle everything from code quality to performance and SEO.
The Basic Anchor Tag
Links in HTML are created with the anchor element, written as the letter a. The href attribute specifies the destination URL, and the text between the opening and closing tags becomes the clickable link text. A basic example looks like this:
<a href="https://example.com">Visit Example</a>When a user clicks the text Visit Example, the browser navigates to the specified URL. The link text should clearly describe where the link leads, which helps users and search engines understand its purpose.
Absolute vs. Relative URLs
An absolute URL includes the full address, including protocol and domain, such as https://example.com/about. Absolute URLs are used when linking to external websites. A relative URL points to a location relative to the current page, such as about.html or /contact. Relative URLs are ideal for internal links because they continue to work if your domain changes or when testing locally.
<a href="/about">About Us</a><a href="services/design.html">Design Services</a>Opening Links in a New Tab
To open a link in a new browser tab, add the target attribute with the value _blank. When doing this, include rel="noopener noreferrer" to prevent the new page from gaining access to the original page through the window.opener property, which is a security risk.
<a href="https://example.com" target="_blank" rel="noopener noreferrer">Open Example</a>Use new tabs sparingly, typically for external resources, because unexpected new tabs can confuse some users. Consider indicating visually or with screen reader text that the link opens in a new tab.
Linking to a Section on the Same Page
You can link to a specific section of a page using fragment identifiers. First, give the target element an id attribute. Then create a link with a hash followed by that id. This technique is useful for tables of contents, long articles, and single-page websites.
<a href="#pricing">Jump to Pricing</a><section id="pricing">...</section>Email and Phone Links
HTML links can trigger email clients and phone dialers. Use the mailto scheme for email and the tel scheme for phone numbers. These links are particularly useful on mobile devices, where tapping a phone link starts a call immediately.
<a href="mailto:hello@example.com">Email Us</a><a href="tel:+15551234567">Call Us</a>Linking Images and Download Files
You can wrap an image element inside an anchor to make the image clickable. Always include descriptive alt text so screen reader users know where the link leads. To prompt a file download instead of opening it in the browser, add the download attribute to the link.
<a href="/files/guide.pdf" download>Download the Guide</a>Accessibility Best Practices for Links
Accessible links benefit everyone. Use descriptive link text rather than vague phrases like click here. Ensure links are visually distinguishable from regular text through color and underlines, with sufficient contrast. Make sure links are keyboard accessible and display a visible focus indicator. Avoid using links for actions that should be buttons, such as submitting forms or opening menus.
SEO Considerations for Links
Search engines use links to discover pages and understand relationships between content. Internal links help distribute authority throughout your site, while descriptive anchor text signals relevance. Avoid broken links, which harm user experience and waste crawl budget. Use rel="nofollow" or rel="sponsored" for paid or untrusted links. A well-planned linking structure, created through thoughtful website development, makes your content easier to find and rank.
Styling Links with CSS
Browsers apply default styles to links, but you can customize them with CSS to match your brand. Style the different link states, including normal, visited, hover, focus, and active, so users receive clear feedback as they interact. Keep underlines for links in body text, because they help users distinguish links from surrounding words. Always provide a visible focus style for keyboard users rather than removing outlines. Smooth transitions on hover can add polish without distracting from content. Consistent link styling across your website makes navigation predictable and improves the overall user experience for every visitor.
Conclusion
Linking a web page in HTML is simple with the anchor tag and href attribute, but mastering variations such as relative URLs, new tabs, fragment links, email and phone links, and downloads makes your website more useful. Following accessibility and SEO best practices ensures your links serve both users and search engines. For businesses that need a professionally coded, well-structured website, AAMAX.CO can deliver clean, high-performing solutions.
