HTML Links Summary
An HTML link lets a user click text or another element to move to a different page, file, or location.
<a href="about.html">About Me</a>
Links are created with the <a> element, also called an anchor element. The visible content goes between the opening and closing tags.
Href Tells The Link Where To Go
The href attribute is the link destination. Without an href, an anchor does not work like a normal link.
<a href="https://example.com">Visit Example</a>
<a href="contact.html">Contact</a>
A full web address can point to another website. A file path can point to another page in the same project.
The HTML Attributes lesson explains how attributes add settings to elements.
Links Can Wrap Text Or Inline Content
The text inside a link should explain where the link goes or what it does.
<p>Read the <a href="schedule.html">class schedule</a> before signing up.</p>
Specific link text is more useful than vague text such as click here.
Opening A Link In A New Tab
The target attribute can tell the browser to open a link somewhere else. The common value _blank opens the destination in a new tab or window.
<a href="https://example.com" target="_blank" rel="noopener">Visit Example</a>
Use new tabs only when they help the user keep their place. The rel="noopener" attribute is a good safety habit when using target="_blank".
Links Are Inline Elements
Links are usually inline elements, so they can sit inside a sentence without starting a new line.