September 18, 2022
Share

Links form the backbone of the web. They enable us to navigate from one page of the website to the other. Without the links, we are doomed 😌. We can have basically two types of links i.e. the internal links and external links. Internal links help us link to the pages within our website e.g. our website could be made up of 3 pages—home page, about page, and contact page. Links that link to these pages are called internal links.

The external links help us to link to web pages outside our website like other websites e.g. google.com, youtube, etc. These links are normally in form of URLs like https://www.google.com — all you need to do is to copy the URL of the website you need to link to from the URL bar. The code snippet below shows how we can come up with links (focus on code in the body tag).

See the Pen Untitled by bmutebi (@bmutebi) on CodePen.

The <a> or anchor element is used to link different pages together. This is followed by an href attribute in the opening tag of the a element. It is in this attribute where we write the name of the page or URL of the page we want the user to go to when clicked. The text wrapped inside the a element is the text we want the user to see.

Note: the user does not see the content of the href, they only see the text inside the a element.