The <a>
element in HTML is the anchor element. We use this to integrate URLs (hyperlinks, email addresses, files, etc.) into the webpage via the href
attribute, which is enclosed within the opening <a>
and closing </a>
tags.
There are some conventions as to how these links appear. All links are underlined by default (this can be modified by using the CSS property text-decoration
). Conventions for colors include:
If the tag has no
href
attribute specified, it can be kept as a placeholder to add a link later on.
The <a>
tag has many attributes in addition to global attributes, including:
Sets the URL to which the link will take the user
Clicking on the href
link will download the target file specified by download
tag
Sets the relationship between the current page and the page to which href
links
Specifies where the page or document should be opened (e.g., in a new tab or on the same one)
The following tag shows how we use the <a>
tag for hyperlinks:
Free Resources