Links

We also want to be able to add links to our website, these might be links to:

  • Another page on our website
  • Another website
  • A document or file
  • An email address
  • A phone or fax number (yes, people still do that)

To do this, we use the a or anchor element, and will set the href (Hypertext Reference) attribute, to let the browser know where we want to link to, eg. to the She Codes website.

<a href="https://shecodes.com.au">She Codes Australia</a>

Because the a element isn’t self closing, we can also include the link content between the opening and closing tags, this is what will appear on the website.

See the Pen HTML Elements - Links on CodePen.