HTML Text Links

HTML Text Links

HTML Text Link

A webpage can contain various links that take you directly to other pages and even specific parts of a given page. These links are known as hyperlinks.

Hyperlinks allow visitors to navigate between Web sites by clicking on words, phrases, and images. Thus you can create hyperlinks using text or images available on a webpage.

Linking Documents

A link is specified using HTML tag <a>. This tag is called anchor tag and anything between the opening <a> tag and the closing </a> tag becomes part of the link and a user can click that part to reach to the linked document. Following is the simple syntax to use <a> tag.

<a href = "Document URL" ... attributes-list>Link Text</a> 
Example
<!DOCTYPE html>
<html>
   
   <head>
      <title>Hyperlink Example</title>
   </head>
	
   <body>
      <p>Click following link</p>
      <a href = "https://www.google.co.in" target = "_self">Tutorials Point</a>
   </body>
	
</html>

The target Attribute

We have used target attribute in our previous example. This attribute is used to specify the location where linked document is opened. Following are the possible options −

Serial No.OptionsDescriptions
1_blankOpens the linked document in a new window or tab.
2_selfOpens the linked document in the same frame.
3_parentOpens the linked document in the parent frame.
4_topOpens the linked document in the full body of the window.
5_targetframeOpens the linked document in a named targetframe.

Setting Link Colors

You can set colors of your links, active links and visited links using linkalink and vlink attributes of <body> tag.

Download Links

You can create text link to make your PDF, or DOC or ZIP files downloadable. This is very simple; you just need to give complete URL of the downloadable file.