Anchor tag in HTML


<a> Tag in HTML:

a tag stands for anchor tag and it works like a anchor.That means like an anchor it links to other pages, websites, images and many more.

In here you will learn all over html anchor tag and its attributes.

<a> … </a> tag is a double tag and nothing works with out any attributes. That means a tag has some required attributes.

Anchor Tag Attributes:

Anchor tag has some required attributes. href attribute is the must to work with it. There are also other attributes like target, download etc.

href=" " Attribute:

Href attribute is the required attribute for the anchor tag in HTML. href stands for hypertext reference. All links or sources in the hypertext attribute refer that link.

Target=" " Attribute:

Target attribute defines the target where the target of the link appear. That means if you click on the link, where the link target will be appear. The values of the target attribute starts with an underscore sign (_). The values are _self, _blank, _parent, _top.

If you want to open your targeted file in a different tab, then you have to use _blank value in your target attribute.

hreflang=" " Attribute:

hreflang defines the language of the link of the anchor tag. Simply type the first two letters of the language into the hreflang attribute.

Download=" " Attribute:

To download a file or image, you have to use simply download attribute into the anchor tag. It will work both with and without the value of the attribute.

<!DOCTYPE html>

<title>Anchor Tag</title>

<!---------- Link with other pages in the same site------------>
<!---------- Link with page file------------>
<a href="image.html">Image Tutorial</a>
<!---------- Link with page file------------>
<a href="html-table"> HTML Table Page</a>

<!---------- Link with image------------>
<a href="image file name/image.extension"> See the image</a>

<!---------- Link with another site------------>
<a href=""> Google</a>
<!---------- open link in new tab------------>
<a href="" target="_blank"> Google</a>

<!---------- download file------------>
<a href="image1.png" download> download


<a href="image2.png" media="min-width: 250px" download="facebook">
<p>Page 1 of 6 <a href="/print/1234" media="print">Print All</a></p </body>


If you find some necessity, Share the article to your social profile. Thanks a lot!