coding180 icon


HTML Element: Link to another Website <a>

HTML Element: Link to another Website <a>

Tutorials > HTML > Anchor Elements

The syntax to provide a hyperlink to another website is:

<a href="">Google Search Engine</a>

Now we initialize the href property with the domain name of the other site.

Something important that must precede the domain name is to specify the type of protocol to use. When it comes to a web page, the protocol is HTTP or HTTPS.

Summarizing the href property, we initialize it with the name of the protocol (HTTP) followed by a colon (:)  and double slash (//) then the string (www.) and finally the domain name of the site to link to.

The following page shows a hyperlink to the main site of the Google search engine:

<!DOCTYPE html>

    <title>Page title</title>
    <meta charset="UTF-8">

    <a href="">Google Search Engine</a>


Let's analyze this page.

The browser request a page from a server to load it in the browser: What page does it return to us from the domain?

The answer is that every server when it receives a request for a page without indicating its name, (that is, there is only the domain name) it selects and sends a page that the server has configured as the main page, example index.html, index.php.

We may link to a particular page on another site. Let's see an example, if we want to have a link (hyperlink) to the page about.html of the domain, the syntax will be as follows:

<a href="">About coding180</a> 

We must know exactly the name of the page (in this case about.html) and also if the page is not in the root directory we must know exactly the directory path.


Robort Gabriel

Lagos, Nigeria

Freelance Web Developer, Native Android Developer, and Coding Tutor.

  • UI / UX
  • JavaScript
  • Python
  • PHP
  • Kotlin
  • Java
  • Bootrap
  • Android
  • Laravel