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.


<a href="">Tutorial</a>
Output - Tutorial

The site will be open on click Tutorial link. Using Anchor tag we can link text, image, icon etc.


<a href="">
<img src='images/etplogo.png'/>

Link Attributes

href Attribute

href attribute specifies the link to the destination url.


<a href="">Link to Google </a>

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


<a href="">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.


<a href= "#thirdpara">Go to third paragraph</a>
<a href="">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.


<a href= "" target="_blank">Open in a new tab</a>
<a href= "" target="_self">Open the link in the same frame</a>
<a href= "" target="_parent">Open the link in the parent frame</a>

Read more articles

General Knowledge

Learn Popular Language