Links and media: Relative navigation links
A root-relative href resolves from the site root; a fragment targets an element in the same document.
Current edit
Understand the pattern
A root-relative href resolves from the site root; a fragment targets an element in the same document.
A root-relative href resolves from the site root; a fragment targets an element in the same document.
Misconceptions to reject
- A visual appearance alone guarantees the intended HTML meaning.
- Replacing semantic elements with generic divs automatically improves accessibility.
The preview is a sanitized subset, not a full browser compatibility test.
Worked example and expected result
<a href="/unix/">UNIX course</a>
<a href="#practice">Jump to practice</a>
<section id="practice"><h2>Practice</h2></section>A root-relative href resolves from the site root; a fragment targets an element in the same document.
Explain it
Apply it elsewhere
Keep the momentum.
Complete the lab, then explain and apply the pattern.
Next: Links and media: Descriptive link textTry an incident drillAnonymous lesson and mastery progress lasts for this session. Sign in to keep synced lesson XP between sessions; mastery stays device-local. No speed bonus, lost lives, or hint penalties.
Keep learning
- 01Links and media: Descriptive link textA link should communicate its destination without requiring the reader to guess from nearby sentences.Practice
- 02Links and media: Current-page navigationaria-current="page" identifies the active page within navigation without making the link disappear.Practice
- 03Links and media: Images with useful alt textAlternative text communicates the relevant content of an informative image. Purely decorative images use empty alt text.Practice