Links, images and lists
Links
Goal: Create absolute, relative and in-page links · 8 min
Links use the anchor element: <a href="target">link text</a>.
- Absolute URL:
https://example.org/about— another website. - Relative URL:
about.html,../images/logo.png,/contact— within your own site (/starts at the site root,..goes one folder up). - Fragment:
#faqjumps to the element withid="faq"on the same page. - mailto: and tel: open e-mail or phone apps.
Write descriptive link text: "Download the timetable (PDF)" instead of "click here" — screen-reader users often list all links out of context. target="_blank" opens a new tab; use it sparingly.
Worked example: Three kinds of links
- External: full https URL.
- Internal: relative path to another page.
- Fragment: jumps to id="contact" further down.
<a href="https://www.w3.org/">W3C</a>
<a href="team.html">Our team</a>
<a href="#contact">Contact</a>
<h2 id="contact">Contact</h2>