HTML- Text Links

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

Example :-

This will produce the following result, where you can click on the link generated to reach to the home page of Tutorials Point
Result :-

Click the fallowing links

Designerspoint

HTML Links - The target Attribute

Value Description
_blank Opens the linked document in a new window or tab
_self Opens the linked document in the same window/tab as it was clicked (this is default)
_parent Opens the linked document in the parent frame
_top Opens the linked document in the full body of the window
framename Opens the linked document in a named frame

Example :-

Result :-

Click any of the following links

Opens in New | Opens in Self | Opens in Parent | Opens in Body

Use of Base Path

When you link HTML documents related to the same website, it is not required to give a complete URL for every link. You can get rid of it if you use <base> tag in your HTML document header. This tag is used to give a base path for all the links. So your browser will concatenate given relative path to this base path and will make a complete URL.

Example :-

Result :-

Click the following link

HTML Tutorial

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 as follows ?

Example :-

Result :-

Click for download the file

Download PDF File