HTML Links - Hyperlinks


Links allows users to jump on another page, it is base element of every HTML website. This links are in HTML terminology called Hyperlinks.

HTML Link syntax

<a href="url">Some text</a>

Links can be used also on images, paragraphs and on any HTML tag / element.

HTML Link to URL address

<a href="https://codedocs.org">Go to CodeDocs.org</a>


HTML target attribute

Target attribute tells where to open link

  • _self - default attribute, don't need to add if we want display webpage in current browser tab
  • _blank - usually open a new tab, but users can configure browsers to open a new window instead.
  • _parent - the parent browsing context of the current one. If no parent, behaves as _self
  • _top - the topmost browsing context (the "highest" context that’s an ancestor of the current one). If no ancestors, behaves as _self

Please see below how to target attribute use

HTML Link with target _blank to open link in new tab

<a href="https://codedocs.org" target="_blank">Go to CodeDocs.org and open in new tab</a>


Link to E-Mail address or phone number

In href attribute you can write E-Mail address and after you click on link it will open E-Mail client. Also when you type telephone number into href attribute it will directly call that number when you click at that link on smartphone.

HTML Links with E-Mail address and phone number

<a href="mailto:somemail@mail.com">Send E-Mail</a>
<a href="tel:+421904102101">Call someone</a>


By: Tomas Silny
Edited: 2020-11-07 20:31:31
Source: developer.mozilla.org/