HTML · Lesson 4 of 9
Links
The <a> element, absolute vs relative URLs and opening in a new tab.
Links are made with the anchor element: <a href="URL">text</a>.
- Absolute URL — a full address:
https://example.com/page. - Relative URL — a path on the same site:
/jobs/orabout.html. - Page section —
href="#contact"jumps to the element withid="contact". - Email / phone —
mailto:andtel:.
Add target="_blank" rel="noopener" to open a link in a new tab safely. Write link text that makes sense on its own — avoid “click here”.
Try it yourself
Edit the code and press Run (or Ctrl/⌘ + Enter). Code runs only in your browser, in a sandbox.
Key points
- href holds the destination.
- #id links jump within a page.
- Use rel="noopener" with target="_blank".
Quick check
Which href jumps to an element with id="faq" on the same page?
A # followed by an id links to that element on the current page.
Practice task
Create a navigation of three links: one to another site in a new tab, one to an #about section on the same page, and one mailto link.
Interview corner
Why add rel="noopener" to target="_blank" links?
It stops the new page from getting access to window.opener, which could otherwise be used to redirect your page (tab-nabbing).
Absolute vs relative URL?
An absolute URL includes the scheme and domain (https://…). A relative URL is resolved from the current page or site root (/jobs/).
Further reading
Official documentation, linked for deeper study. These are outside sites; this lesson's text is our own.
Original lesson written by the InfoparkDaily team · © 2026 InfoparkDaily · Free to learn — no paid course or subscription.