HTML Links
It consists 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.
Example
1 |
<a href="https://phpgurukul.com/">PHPGurukul | Programmong Blog</a> |
Here. <a>
: Anchor tag which add the link to any reference text, image etc.
href (hypertext reference): It specifies the destination for the anchor tag.
- Local Links: It is specified with a relative URL. E.g. php_tutorials.php
- Global Links: It is an absolute URL (Full website address).
HTML Link Colors
The color of the link is distributed into three categories 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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
<html> <head> <style> a:link { color: red; } a:visited { color: yellow; } a:active { color: blue; } </style> </head> <body> <a href="php_tutorials.php" >PHP tutorials</a></body> </html> |
Link Usage
Text as link
1 |
<a href="https://phpgurukul.com/php-tutorials/">PHP Tutorials</a> |
Output
PHP TutorialsImage as link
1 |
<a href=”https://phpgurukul.com/”><img src=”http://localhost/wordpress/wp-content/uploads/2016/05/phpgurukul-1.png”></a> |
Output
Email tag
1 |
<a href="mailto:support@phpgrukul.com">Send Mail </a> |
Output
Send Mail