We get to a point when building websites and we want a page to lead or go to another page. Its no news that most websites have the “about us”, “contact us” options on their webpage.

So how do we go about this? how do we link a page to another page? how do we navigate through pages on our websites?

The in html helps in doing this using the HREF attribute.

We might be confused at some point , what then is adding link to your head tag? It also uses HREF attribute after all?

They are two different things and they are added differently.

The external links we add to our head tags works solely on the body.

For example, adding the bootstrap CDN and the google font link

<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"/>

<link href="https://fonts.googleapis.com/icon?family=Material+Icons"rel="stylesheet"/>

</head>

You can’t access these links on your website. They cannot be seen on your website, you only see the effects on the content in the body.

How then will I add a link to my website?

Like I said earlier, the use of and tags is used to add a link to a website. The tag indicates where the hyperlink starts and the tag indicates where it ends. Whatever text gets added inside these tags, will work as a hyperlink.

<head>
   ...
</head>

<body>

   <a>Click me</a>

</body>

You will notice from the code snippet that the tag is inside the body tags. It goes in the body tags where it can be seen and clicked.

But Click me is not yet a “link” if the href attribute is not added.

The **href **attribute is the most important attribute of the hyperlink. It indicates the link’s destination.

#front-end-development #href #html

HTML Link Code — How to Insert a Link to a Website with HREF
1.15 GEEK