Using Anchor Tags for Hyperlinks
1.1 Introduction
The ‹a› tag or anchor tag, is used to create a hyperlink to another webpage or another location within the same webpage. The hyperlink created by an anchor tag is applied to the text, image, or other HTML content nested between the opening and closing ‹a› tags. The most important attribute of the ‹a› tag is the href (hyperlink reference) attribute, which indicates the link's destination.
By default, links will appear as follows in all browsers:
- An unvisited link is underlined and blue
- A visited link is underlined and purple
- An active link is underlined and red
1.2 Syntax
‹a href="pagepath/pagename"›hyperlink‹/a›
‹a href="http://vlab.co.in/index.html"› Visit Lab ‹/a›
1.3 Attributes of ‹a› tag
Attribute | Value | Description |
---|---|---|
href | url | Specifies the URL of a page |
target | blank, parent, self, top | Specifies Where to open the target URL |
download | filename | This downloads the target when user clicks on the hyperlink |