Links

The anchor element <a> is used to link to another page or to a certain part of the page if you use its id. And the <link> element defines a link between a document and an external resource.

<a> links are visible to the end users, whereas <link> links are not.

Anchor Element

The <a> anchor element is used to create hyperlinks in an HTML document. The hyperlinks can point to other webpages, files on the same server, a location on the same page, or any other URL using the hyperlink reference attribute, href.

The href determines the location the anchor element points to.

Text Link

Loading...

Image Link

Loading...

Link Element

The <link> is used to connect the document to an outside resource, most commonly stylesheets. Unlike most elements, which come as opening and closing tags, the <link /> is self-closing and only contains attributes.

The two primary attributes are:

  • A rel to describe the format of the external source.
  • An href that contains the filepath to the external source.
Loading...
Interested in helping build Docs? Read the Contribution Guide or share your feedback.

Learn HTML on Codecademy