Links and Anchors in HTML

The <a> tag defines a hyperlink, which is used to link one page to another. The most important attribute of the <a> element is the href attribute, which indicates the destination of the link.

Relative vs. Absolute Links

Relative links point to a file within the same site (e.g., href="about.html"), while absolute links point to a URL outside of the site (e.g., href="https://www.example.com").

Link Text

The text between the opening and closing <a> tags is the link text that users see. For example, in <a href="https://www.example.com">Visit Example.com</a>, "Visit Example.com" is the link text.

Email Links

Use the target attribute to specify where to open the linked document. For example, target="_blank" will open the link in a new tab.

Link Targets

Use the target attribute to specify where to open the linked document. For example, target="_blank" will open the link in a new tab.

For instance, check out this link, which will open in a new tab!

Click here!