
Hyperlinks are the foundation of the World Wide Web. Without them, the internet would be a collection of isolated documents rather than a connected network of information. Every time you click a menu item, a button, or a highlighted word that takes you to another page, you are using an HTML link. Learning how to create web links in HTML is one of the first and most important skills for anyone building websites. In this guide, we explain the anchor element, its key attributes, different types of links, and best practices for usability, accessibility, and SEO.
Get Expert Help from AAMAX.CO
While creating a single link is simple, building a website with intuitive navigation, logical internal linking, and search-friendly structure takes careful planning. AAMAX.CO is a full service digital marketing company providing web development, digital marketing, and SEO services worldwide. They design site architectures where every link has a purpose, guiding visitors toward key pages and helping search engines understand content relationships. Their website development experts write clean, standards-compliant HTML so your links remain accessible, crawlable, and easy to maintain as your site grows.
The Basic Anchor Tag
In HTML, links are created with the anchor element, written as the a tag. The most important attribute is href, short for hypertext reference, which defines the destination. The text between the opening and closing tags becomes the clickable link text. A basic example looks like this:
<a href="https://www.example.com">Visit Example</a>
When a browser renders this code, the words Visit Example appear as a clickable link, usually underlined and colored blue by default. Clicking it takes the user to the specified address. This simple structure is the building block for every type of link you will create.
Absolute vs. Relative Links
An absolute link includes the full web address, including the protocol and domain, such as https://www.example.com/about. Use absolute links when pointing to external websites. A relative link points to a location relative to the current page, such as about.html or /blog/post-one. Relative links are ideal for internal navigation because they keep working even if your domain changes or you move the site between development and production environments. A leading slash means the path starts from the root of your site, while no slash means the path starts from the current folder.
Opening Links in a New Tab
Sometimes you want an external link to open in a new browser tab so visitors do not leave your site entirely. Add the target attribute with the value _blank. For security, also include rel="noopener noreferrer", which prevents the new page from accessing your page through the window.opener object:
<a href="https://www.example.com" target="_blank" rel="noopener noreferrer">Open in new tab</a>
Use this behavior sparingly. Opening too many new tabs can frustrate users, especially on mobile devices. Many accessibility experts recommend indicating that a link opens in a new tab, either with an icon or visually hidden text.
Linking to Sections on the Same Page
Long pages benefit from jump links that take readers directly to a specific section. First, give the target element an id attribute, such as id="pricing". Then create a link whose href begins with a hash symbol followed by that id:
<a href="#pricing">Jump to Pricing</a>
<section id="pricing">...</section>
You can also combine a page path with an anchor, such as /services#seo, to link to a section on another page. Adding the CSS property scroll-behavior: smooth to the html element creates a pleasant scrolling animation.
Email and Phone Links
HTML links are not limited to web pages. Use the mailto scheme to open the visitor's email client with a pre-filled address, and the tel scheme to let mobile users call with a single tap:
<a href="mailto:hello@example.com">Email Us</a>
<a href="tel:+15551234567">Call Us</a>
You can even pre-fill a subject line by adding ?subject=Your%20Subject to the mailto address. These links are especially valuable for local businesses and service providers whose visitors want to make contact quickly.
Download Links and Image Links
To prompt a file download instead of opening it in the browser, add the download attribute to a link pointing to a file, such as a PDF brochure. You can also wrap an image inside an anchor tag to make the image clickable. When you do this, make sure the image has descriptive alt text, because that text becomes the accessible name of the link for screen reader users.
Styling Links with CSS
Default link styles are functional but rarely match a brand. CSS lets you style links in different states using pseudo-classes: :link for unvisited links, :visited for visited links, :hover when the mouse is over the link, :focus-visible for keyboard focus, and :active while it is being clicked. Always keep links visually distinguishable from surrounding text, and never remove focus outlines without providing a clear alternative, since keyboard users depend on them to navigate.
Accessibility and SEO Best Practices
Good link text describes the destination. Avoid vague phrases like click here or read more on their own; instead, write descriptive text such as download the pricing guide. Screen reader users often navigate by listing all links on a page, so meaningful text improves their experience dramatically. Search engines also use anchor text to understand what the linked page is about, which makes descriptive internal links a powerful SEO tool. Link to relevant internal pages naturally, fix broken links promptly, and use the rel="nofollow" or rel="sponsored" attributes for paid or untrusted external links.
Testing Your Links
Before publishing, click through every link to confirm it reaches the right destination. Tools like browser developer consoles, online broken link checkers, and SEO crawlers can scan entire sites for errors. Check links on mobile devices too, ensuring tap targets are large enough and spaced comfortably apart.
Conclusion
Understanding how to create web links in HTML opens the door to building connected, user-friendly websites. With the anchor tag and a handful of attributes, you can link to external sites, internal pages, specific sections, email addresses, phone numbers, and downloadable files. Combine these techniques with clear link text, accessible styling, and thoughtful site structure, and your links will serve both visitors and search engines effectively.
