<a> tag in HTML
The <a> tag used to create a hyperlink with the help of href attribute. The href attribute is used to define the address of the file to be linked.
The hyperlink is usually a link to another document OR link one page to another webpage OR provide another location link within the same webpage, etc.
Important Description
- Use the <a> tag to link text or images.
- These attributes - download, hreflang, media, rel, target, and type cannot be present if the href attribute is not present.
- A linked page is normally displayed in the current browser window, unless you specify another target.
Example of <a> tag
<a> Tag Browser Support
All old and modern browsers are support <a> tag to display the link:
Element |
Chrome |
Edge |
Firefox |
Safari |
Opera |
<a> |
Yes |
Yes |
Yes |
Yes |
Yes |
Global Attributes
Event Attributes
Attributes with description
Attribute |
Value |
Description |
href |
URL |
A hyperlink can link to pages on your own domain, to other websites, or to a file |
hreflang |
language_code |
Language code of the destination URL. |
download |
filename |
Directs the browser to download the linked resource rather than opening it. |
target |
_blank _parent _self _top framename |
Specifies where to open the linked document |
type |
media_type |
Specifies the media type of the linked document |
media |
media_query |
Specifies what media/device the linked document is optimized for |
ping |
list_of_URLs |
Specifies a space-separated list of URLs to which, when the link is followed, post requests with the body ping will be sent by the browser |