In this tutorial, we will learn about hyperlink , use image and email as link in HTML with the help of examples.
A Link is a connection from one page to another page. A web page can contain various
links that take you from one page to another.
These links also allow users to jump one section to another section on the same webpage.
HTML links are also known as Hyperlinks.These links don’t have to be text.
A link can be an image or any other HTML element.
The <a> element defines a hyperlink.
The href attribute is the most important attribute of <a> element.
By default, hyperlinks will display as follows in all browsers:
- Unvisited link – it is underlined and blue.
- Visited link – It is underlined and purple.
- Active link – It is underlined and red.
Attributes of <a> Element
|href||URL||It specify the link's destination|
|target||_blank, _self, _parent, _top||It specify where to open the link in the new tab/window or the same|
Note : A hash # within a hyperlink specifies an html element id to which window should be scrolled.
<a href = "www.algbly.com" target = "_blank">An HTML Link</a>
Use Image as a link
We can use an image as a link by putting <img> tag inside <a> element.
<a href = "www.algbly.com" target = "_blank">
<img src = "html.jpg" width = "60px">
Link to send Email
We can use an email as a link by putting the value mailto: email_address inside href attribute to create a link.
<a href = "mailto : firstname.lastname@example.org">Send mail</a>
We hope that this tutorial helped you develop better understanding of the concept of Links in HTML.
Keep Learning : )
In the next tutorial, you'll learn about HTML
Block & Inline Tag.