HTML Links: Create Accessible Hyperlinks
Create a hyperlink
An anchor (a) with an href attribute creates a hyperlink. The attribute identifies a destination; the text between the tags tells the reader what they will find. Activate a focused link with Enter or click it with a pointer.
The link points to about.html in the same directory. In an isolated editor, that file may not exist.
Write meaningful link text
Choose words that describe the destination even when read without the surrounding paragraph. Avoid repeating vague labels such as “click here”. A link can contain ordinary inline text markup such as strong.
<p> Read the <a href="hours.html"> <strong>library opening hours</strong> </a> .</p>The visible link text identifies the information the destination provides.
Use links for navigation, buttons for actions
An anchor without href is a placeholder, not a normal hyperlink. Use a real destination for navigation. For actions such as opening a settings panel, use a button (introduced here only for comparison; form controls are covered later). Do not nest buttons or other links inside a link.
<a href="settings.html">Settings page</a><button type="button">Open settings panel</button>The link describes a destination; the button has action semantics but needs behavior added to open a panel.
Practice and next steps
Add a link to a contact page with descriptive text. Then explain why a button is more appropriate for saving a form.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
HTML Links: Create Accessible Hyperlinks — Knowledge Check
Check the core concepts from this lesson.
Which markup creates a hyperlink to hours.html?
Which link text is clearest when read on its own?
Which element best represents a control that opens a settings panel without navigating?
An anchor has text but no href. What is missing for ordinary hyperlink navigation?
Which markup is suitable for emphasis within a navigation link?