HTML Links

Links are used to connect other web resources. By using Link, one web page is connected to one or more web pages. HTML anchor tag <a> is made for link resources. The text within anchor opening and closing tags is displayed on the web page as link. The anchor tag has href attribute that contains the location of web resource. We can link both internal and external resources.

Example

<a href="https://www.etutorialspoint.com/">Tutorial</a>
Output - Tutorial

The site https://www.etutorialspoint.com/ will be open on click Tutorial link. Using Anchor tag we can link text, image, icon etc.

Example

<a href="https://www.etutorialspoint.com/">
<img src='images/etplogo.png'/>
</a>



Link Attributes

href Attribute

href attribute specifies the link to the destination url.

Example

<a href="http://www.google.com/">Link to Google </a>

href attribute is also used to send mail to a specific email address.

Example

<a href="mailto:etutorialspointsocial@gmail.com">Link to Google </a>

Output of the above code

Contact us





name Attribute

name attribute is used to link the section in the same document or section of the destination document.

Example

<a href= "#thirdpara">Go to third paragraph</a>
<a href="https://www.etutorialspoint.com#lastpara">Go to last paragraph</a>
<p name="thirdpara">This is the third paragraph.</p>

target Attribute

By using target attribute, we can specify where to open the linked document. Like, there may be need to open the document in the new tab, in a new window, in the same frame, in the parent frame.

Example

<a href= "https://www.etutorialspoint.com" target="_blank">Open in a new tab</a>
<a href= "https://www.etutorialspoint.com" target="_self">Open the link in the same frame</a>
<a href= "https://www.etutorialspoint.com" target="_parent">Open the link in the parent frame</a>







Read more articles


General Knowledge



Learn Popular Language