HTML Tutorial
The <a>
tag, short for "anchor," is used to create hyperlinks in HTML documents. It allows you to link to web pages, files, sections within a page, or other resources.
href
: Specifies the destination URL of the link.title
: Provides a tooltip text that appears when users hover over the link.target
: Controls where the linked page opens._blank
: Opens the link in a new tab or window._self
: Opens the link in the same tab or window.rel
: Specifies the relationship between the current page and the linked page. Common values include:noopener
: Prevents the linked page from accessing the current page's window or frames.noreferrer
: Prevents the linked page from knowing where the link was clicked from.<a href="www.google.com">Google</a>
<a href="myfile.pdf">Download File</a>
<a href="mailto:[email protected]">Email John</a>
<a href="#section-name">Jump to Section</a>
For accessibility, it's important to:
title
attribute to provide additional information about the link. HTML Example: Exploring the <a>
Tag
<!DOCTYPE html>
<html>
<body>
<h1>My Website</h1>
<p>
Here is a link to <a href="www.google.com">Google</a>.
</p>
<p>
Want to know more about me? <a href="#about-me">Click here to read my bio</a>.
</p>
</body>
</html>