HTML Links

It consist of anchor element which is used to create a link between a source anchor and destination anchor. The anchor tag can be embedded between text, image, video or button.

HTML Links Syntax:

<a href="url">link text</a>

Example: <a href="https://www.tutorialandexample.com">Tutorial for Html</a>

Here, <a>: Anchor tag which add the link to any reference text, image etc.

href (hypertext reference): It specify the destination for the anchor tag.

  • Local Links: It is specified with a relative URL. E.g. html_tutorials.php
  • Global Links: It is an absolute URL (Full website address). E.g. www.tutorialandexample.com

HTML Link Colors

Color of the link is distributed into three category of type of links:

  • Unvisited Link: Link is not visited even once i.e. first time color of a link.
  • Visited Link: When Unvisited link reaches the destination i.e. color of a link changes if visited
  • Active Link: Link color on click that shows link is working.
<html>  
<head>  
<style>  
a:link {    color: red;    }  
a:visited {  color: yellow;  }  
a:active {   color: blue;  }  
</style>  
</head>  
<body>  
<a href="html_tutorials.php" >HTML tutorials</a></body>  
</html>

LINK USAGE

  • Text as Link: <a href ="tutorialandexample.com/html">Html Tutorial</a>

Output:

Html Tutorial
  • Image as Link: <a href ="tutorialandexample.com/html"> <img src="/image/logo.png" alt= "tutotrialandexample"></a>

Output:

Output:

Send Mail



ADVERTISEMENT
ADVERTISEMENT