HTML links are also known as hyperlinks. When we click on particular links on web pages, they open other web pages. A link does not have to be a text—it can be an image or any other HTML element. It is an integral part of HTML and it is used everywhere.
What is an HTML link?
An HTML link is used to link other web pages to a document. When users click on links on web pages, they are brought to other web pages or websites. An HTML document contains many links, which are also known as hyperlinks. Web developers can link from the text, images, and other types of media.Links are specified in HTML using <a> tags.
<a href=”url” > Text Link </a>
The href attribute is used to specify the link’s destination.
The test link is the visible part of the link.
This will produce the following result—when you click on the link, it will take you to the Simplilearn homepage.
HTML links - The Target Attribute
The target attribute of HTML links specifies where to open the linked document. The following are possible options:
Opens the linked document in a new window or tab
Opens the linked document in the same window or tab
Opens the document in the parent frame
Opens the linked document in the full body of the window
This will produce the following result. Click on the links to see the difference.
Use an Image as a Link
You can also link an image to another web page. To do this, put the <img> tag inside an <a> tag.
This will produce the following result:
When you click on the image, you will be directed to the Simplilearn website.
Setting Link Colors
By default, links will appear as follows:
- An unvisited link will be underlined and blue
- A visited link is underlined and purple
- An active link is underlined and red
With CSS, web developers have the option of customizing these link colors.
Link to an Email Address
You can create a link on your web page, which will navigate the user to their system’s default email program using mailto: inside the href attribute.
<a href="mailto:firstname.lastname@example.org">Send email</a>
When you will click on the “send email” link, you will be directed to your email account.
Get skilled in HTML5 and CSS3 with the Full Stack Java Developer Master's Program. Click to check out the program details!
Would You Like to Become a Full-Stack Developer?
Our brief introduction to HTML links covered the basics when it comes to creating and customizing website hyperlinks. We discussed several ways in which we can manipulate the properties of hyperlinks with CSS and coding. When it comes to learning HTML, however, this is just the tip of the iceberg. If you’re serious about taking the next step to advancing your career, certification is highly recommended in today’s competitive job market. Simplilearn’s Full Stack Java Developer course is a comprehensive program that will teach you everything you need to know to master web development Upon completion, students also earn their certifications, which can help them gain an edge over the competition.
If you’re an aspiring web and mobile developer, HTML training will broaden your skills and career opportunities.
Do you have any questions for us? Please leave them in the comments section, and we'll have our experts answer them for you.