HTML Anchor Tag
The Anchor Tag <a> is used for hyperlink one or more documents or within the page or some other documents . An anchor text is created with the help of <a> tag marks the beginning and/or the end of a hypertext link ,this is a text which links to another document . The destination hyperlink can be a web pages, files, email addresses, locations in the same page, or anything else a URL can address.
Example for Anchor Tag
<!DOCTYPE html>
<html>
<head>
<title>HTML anchor tag example</title>
</head>
<body>
<p>This is a link to <a href = “http://www.w3htmlschool.com“>HTML anchor Tag</a></p>
</body>
</html>
Anchor tag Attributes
hreflang – value (anguage_code)
Destination page language is define in this attribute .
Download – Value (filename)
Download option with anchor tag will download the file when someone clicks on the hyperlink.
HREF- value (URL)
Href attributes used to define destination Page URL .
Media – value (media_query)
It specifies what media the linked document is optimized for
Rel – value (designates
Stylesheet alternate start next prev contents index glossary copyright chapter section subsection appendix help bookmark)
Any one in above specifies the relationship between the current document and the linked document
Target – value (_blank
_parent
_self _top )
It specifies where to open the linked document.
Type – value (media_type)
It is use for the media type of the linked document
Browser Support
Chrome | Firefox | IE | Opera | Safari | Android |
Yes | Yes | Yes | Yes | Yes | Yes |