1 Minute HTML CSS Part 7 – Links

ANCHOR TAG

<a href="https://code-boxx.com" target="_self">
  Code Boxx (same window).
</a>
<a href="https://code-boxx.com" target="_blank">
  Code Boxx (new tab).
</a>
  • <a> Anchor tag. Used to create links.
  • href Where to link to.
  • target Where to open the link.
    • _self Open in the same window. This is the default if target is omitted.
    • _blank Open in another tab.

 

IMAGE LINKS

<a href="https://code-boxx.com">
  <img src="image.jpg">
</a>

Apart from text, we can also wrap anchor tags around images to create links.

 

“OTHER” TYPES OF LINKS

<!-- LINK TO EMAIL -->
<a href="mailto:john@doe.com">
  Email John Doe
</a>

<!-- CALL NUMBER -->
<a href="tel:123-456-7890">
  Call John Doe
</a>
<!-- SEND SMS -->
<a href="sms:123-456-7890">
  Message John Doe
</a>

Anchor links are not limited to webpages.

  • mailto: Send an email.
  • tel: Telephone call.
  • sms: Send an SMS.