HTML links are used to connect one web page to another. Links allow users to navigate between pages, websites, and different sections of content.
Almost every website uses links for navigation, menus, buttons, and references.
The <a> Tag
HTML links are created using the <a> tag. The destination of the link is specified using the href attribute.
In this example:
- <a> defines a hyperlink
- href specifies the destination URL
- The link text is what users click
Types of HTML Links
There are different types of links used in websites:
- External links (link to other websites)
- Internal links (link to pages within the same website)
- Anchor links (link to a section on the same page)
Internal links help users navigate within a website, while external links take users to other websites.
Both are important for usability and SEO.
Opening Links in a New Tab
The target attribute is used to control how a link opens.
Using target="_blank" opens the link in a new browser tab.
Best Practices for HTML Links
- Use meaningful link text
- Avoid using "click here"
- Make sure links are accessible
- Use internal links to improve navigation
Why Links Matter for Jobs
Navigation is a core part of every website. Employers expect developers to understand how links work and how to structure navigation properly.
Correct use of links improves user experience and SEO.
Practice Task
Create a simple page with links to two internal pages and one external website. Try opening one link in a new tab.
What You Will Learn Next
In the next lesson, you will learn how to display images on a webpage using HTML.