Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

html

What is <a> element in HTML?

Sheza Munir

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.

Conventions

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:

  • unvisited links are blue
  • visited links are purple
  • active links are red

If the tag has no href attribute specified, it can be kept as a placeholder to add a link later on.

Attributes supported

The <a> tag has many attributes in addition to global attributes, including:

href



download



rel



target

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)

Code

The following tag shows how we use the <a> tag for hyperlinks:

RELATED TAGS

html

CONTRIBUTOR

Sheza Munir
Copyright ©2022 Educative, Inc. All rights reserved
RELATED COURSES

View all Courses

Keep Exploring