Html Link Tags

Html Link Tags

Hello everyone! In this article, we will talk about links in HTML.

As we know, HTML stands for HyperText Markup Language. The reason why it is referred to as a HyperText language is because it gives access to other webpages i.e users can navigate from a website or webpage to another website or webpage. This navigation is made possible using HyperLinks or normally put links.

Links are what you click on to jump or move to another webpage/web document or website. when a pointer hovers over it, it turns the mouse's arrow to a little hand :-).They are also used to import documents or images into a webpage.

There are several kinds of links in HTML. The commonly used are:

  • The anchor tag link <a></a>

the anchor tags are used to add links of other webpages or websites to aid navigation. It has the format:<a href="link_url"> Link description </a>. Where href stands for hypertext reference.

  • The Image tag link <img/>

This is a self-closing tag i.e it doesn't require a separate closing tag. This tag link is used to add images to a webpage or website. It has the format: <img src="image_url" alt="image_descripton" />. Where src stands for source (the url or pathname of the image) and alt stands for alternative (it allows one give a description of the image).

  • JavaScript tag link <script></script>

It is used to add JavaScript codes to an HTML file. It has the format: <script src="JavaScriptFile.js"> //JavaScript_codes_goes_here </script>. Where src attribute is used to specify the name of the JavaScript file to be imported.

  • The rel link <link rel="rel_goes_here">

The rel attribute defines the relationship between a linked resource and the current document. The most common use of rel link is in the importation of the stylesheet file(CSS). It has the format <link rel="stylesheet" href="CSS_file.css">. Where href is the attribute used to specify the CSS file name. URL are used to tell the browser the location of the links placed in the link tags.

WAYS OF URL IMPORTATION

Adding URL can be done in two ways:

  1. Absolute importation : Absolute path importation involves adding URL, including protocol ( http / https ), the optional subdomain (e.g. www ), domain( developer.com ), and path (which includes the directory and slug). Example https://www.developer.com/temitech/dev/.

  2. Relative path: Relative path importation is a URL that only includes the path of everything that comes after the domain, including the directory and slug. Because relative URLs don't include the entire URL structure, it is assumed that when linking a relative URL, it uses the same protocol, subdomain and domain as the page it's on. Using a relative path signifies that the file to be included is already in the present repository/directory or uses same protocol and domain name of the present page it is to be imported to. Example: From the absolute example, i can search /temitech/dev/ if i'm already in https://www.developer.com/ webpage.