HTML Basics: Creating links • Linking text or images • Inserting hyperlinks with A href • Structure of hyperlinks

Creating links with the A tag

A hyperlink is a link to another webpage. This can be a subpage of your own website or a page on another website. Basically, any navigation is made up of hyperlinks. Link is short for hyperlink, and it means the same thing.

Links are usually indicated in color and are underlined by default.

A link is always made up of two parts, a URL and a link text, e.g. HTML basics.
(<a href="https://www.website-advisor.de/en/html-basics.php">HTML basics</a>)

Example

Creating a link using <a href="…">

<a href="URL">link text</a>   [1]
Advertisement

URL – What does it mean?

In common language, we often talk about a link when we really mean a URL. URL stands for Uniform Resource Locator. It refers to the address that identifies a file on a server. The colloquial terms Internet address or Web address are more commonly used than URL.

How is a URL built?

A URL consists of the following components:

  1. Protocol, e.g. http://, https:// oder ftp://

  2. Sub-Domain, e.g. www, www2 or blog

  3. Domain name, e.g. www.website-advisor.de

  4. Directory path, e.g. en

  5. File name, e.g. html-basics.php

Subdomain and domain are separated by a dot '.'.

Summarized the URL is e.g.
https://www.www.website-advisor.de/en/html-basics.php

It is recommended to use speakink URLs because they help people understand what your site is about.

Inserting the URL into the HTML A tag[1] results in something like this

<a href="https://www.website-advisor.de/en/html-basics.php">link text</a>   [2]
Advertisement

HTML tags can be nested. If you want to use an image in a link instead of anchor text, just replace the Anchor Text by an IMG Tag in the HTML tag[2].

So the HTML tag for an image link is, for example:

<a href="https://www.website-advisor.de/en/html-grundlagen.php"><img src="/images/image.png" alt="Description of the Image"></a>