HTML Anchor
The HTML anchor tag defines a hyperlink that links one page to another page. It can create hyperlink to other web page as well as files, location, or any URL. The "href" attribute is the most important attribute of the HTML a tag. and which links to destination page or URL.
href attribute of HTML anchor tag
The href attribute is used to define the address of the file to be linked. In other words, it points out the destination page.
The syntax of HTML anchor tag is given below.
<a href = "..........."> Link Text </a><br>
Specify a location for Link using target attribute
If we want to open that link to another page then we can use target attribute of tag. With the help of this link will be open in next page.
<!DOCTYPE html>
<html>
<head>
</head><body>
<h4>Display of href attribute</h4>
<p>Below is the link of anchor tag, click the link and see the next page</p>
<a href="https://touchtogain.blogspot.com" target="_blank">This is a link</a>
</body>
</html>
Display of href attribute
Below is the link of anchor tag, click the link and see the next page
This is a linkThe target attribute can only use with href attribute in anchor tag.
If we will not use target attribute then link will open in same page.
Appearance of HTML anchor tag
- An unvisited link is displayed underlined and blue.
- A visited link displayed underlined and purple.
- An active link is underlined and red.