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.
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>
Example
<!DOCTYPE html>
<html>
<head>
<title>HTML Tutorials</title>
</head>
<body>
<p>Click on <a href="https://mybcaclassnotes.blogspot.com/p/html-tutorials.html" target="_blank"> this-link </a>to go on home page of MyBcaClassNotes.</p>
</body>
</html>
Note:
- The 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.
The target attribute can have one of the following values:
- _self - Default. Opens the document in the same window/tab as it was clicked
- _blank - Opens the document in a new window or tab
- _parent - Opens the document in the parent frame
- _top - Opens the document in the full body of the window
An unvisited link is displayed underlined and blue.
A visited link displayed underlined and purple.
An active link is underlined and red.
No comments:
Post a Comment