Last Updated: March 11, 2021
·
2.241K
· JimmyJW

How to insert a hyperlink in HTML

The <a> tag is one of the essential HTML elements for creating links. Depending on the presence of the name or href attributes, the <a> tag sets the link or anchor. An anchor is a bookmark within a page that you can specify as the target of a link. When you use a link that points to an anchor, you navigate to a bookmark within a web page.

To create a link, you must tell the browser what the link is, and also indicate the address of the document to which the link should be made. As the value of the href attribute, the address of the document (URL, Universal Resource Locator) is used, to which the transition occurs. The link address can be absolute or relative. Absolute addresses work everywhere and everywhere, regardless of the name of the site or web page where the link is registered. Relative links, as their name suggests, are built relative to the current document or site root.

Example

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>TAG</title>
</head>
<body>
<a href="images/xxx.jpg">PHOTO</a></p>
<a href="tip.html">PHOTO</a></p>
</body>
</html>

Oddly enough, many people now do not know how to correctly insert a hyperlink into HTML, and then this may cause him some difficulties.