The HTML5 a Tag
The HTML5 <a> tag is essential when it comes to determining a particular hyperlink. The <a> tag enables to establish a connection from one web page to another. The most essential part of the <a> tag is the href attribute. It is easier to define the destination where a particular link would lead to.
Regardless of the web browser that you are using—whether it is Internet Explorer, Firefox, Opera, Google Chrome or Safari—the links would still appear the same way. If the link has not been opened yet, this remains underlined and is blue in color. If the link has already been visited, the color changes to purple but remains underline. On the other hand, a link that is active is color red and still underlined.
The Global Attributes for HTML 5 are also supported by the <a> tag. Examples of the Global Attributes include contextmenu, dropzone, or accesskey. Aside from that, even the Events Attributes for HTML 5 are supported by the <a> tag. This includes the Global Event Attributes, Window Events Attributes, Form Events, Keyboard Events, Mouse Events and Media Events.
Be careful not to mix up the use of the <a> tag in HTML 4.01 and HTML5. These two have different usage of the <a> tag. For the HTML 4.01, this tag could be utilized as a hyperlink. There are occasions when this is also serves as an anchor. For the HTML 5, the <a> tag always remains as a hyperlink. In occasions when there is no href attribute, the <a> tag serve as a placeholder for the hyperlink.
Attributes of the HTML5 <a> tag are:
Attribute |
Value |
Comments |
charset |
Encoding |
HTML5 does not support |
coords |
Coordinates |
HTML5 does not support |
href |
URL |
URL of the link |
hreflang |
Language Code |
Spells out language type |
media |
Media Query |
Specified media device type |
name |
Name of a section |
HTML5 does nto support |
rel |
alternate author bookmark help license next nofollow noreferrer prefetch prev search tag |
Relationship type between links |
rev |
String |
HTML5 does not support |
shape |
default rect circle poly |
HTML5 does not support |
target |
_blank _parent _self _top framename |
Sets method how link will be opened. |
Type |
MIME |
Specifies MIME Type |