a tag
The a tag, which, when implemented in the code, is written like this - <a>, is an HTML tag that belongs to link tags. Link HTML tags are used to define hyperlinks and their groups - tools that are used to navigate through the parts of a pages, different pages of a website or connect different websites.
<a> defines a hyperlink - a tool which allows users, browsers and search engine to go from one website to another, or from one part of a website to a different part of the same website. This tag is supported in the current version of HTML, which is HTML5.
Browser support
Here you can see whether <a> is supported by a certain browser, and, if yes, starting from which version it is supported.
Chrome | Firefox | Edge | Opera | Safari |
---|---|---|---|---|
Is supported | Is supported | Is supported | Is supported | Is supported |
Attributes and values
An attribute is a piece of additional information about a tag. While tags denote the type of objects they mark or create, attributes set the parameters of these objects. These parameters can include anything from the types of possible interactions to its visual style to its actual contents.
Values indicate how a certain attribute is actually implemented, if there is a number of ways it can happen.
What attributes are actually allowed in a certain tag depends on the tag itself. Much like possible attributes depend on a tag, possible values depend on an attribute.
The <a> tag supports the following attributes (with their respective values):
Attribute | Value | Description |
---|---|---|
charset | char_encoding | Specifies the character-set of a linked document (Not Supported in HTML5) |
coords | coordinates | Specifies the coordinates of a link (Not Supported in HTML5) |
download | filename | Specifies that the target will be downloaded when a user clicks on the hyperlink |
href | URL | Specifies the URL of the page the link goes to |
hreflang | language_code | Specifies the language of the linked document |
media | media_query | Specifies what media/device the linked document is optimized for |
name | section_name | Specifies the name of an anchor (Not Supported in HTML5) |
rel |
| Specifies the relationship between the current document and the linked document |
rev | text | Specifies the relationship between the linked document and the current document (Not Supported in HTML5) |
|
| Specifies the shape of a link (Not Supported in HTML5) |
|
| Specifies where to open the linked document |
media_type | media_type | Specifies the media type of the linked document |
Global Attributes
Global attributes are HTML tag attributes that can be used by any tag, hence the name "global". They are in contrast to unique attributes that are tag-specific.
<a> supports global attributes.
Event Attributes
Event attributes are HTML tag attributes that allow triggering actions upon specific conditions, hence the name "event". Other types of attributes, namely global and unique attributes, can also trigger actions, but the difference is that even attributes allow calling scripts, such as JavaScript functions, while most other attributes only support a certain type of action.
<a> supports event attributes.