An anchor can contain several noninteractive items so a card acts as one navigation target. But links must not contain other interactive content or nested anchors. The important question is always where the link leads and whether the person reading the page can predict it.
What You Need to Know
Prefer simple markup that gives the link a clear accessible name. Put an unrelated action button outside the card's anchor.
Example: See It in Action
Add this example to the appropriate part of a practice HTML page. Read each line before you open the page in your browser.
This is a short HTML fragment. To try it as a webpage, put it inside the body element of a complete HTML document.
<a href="book.html">
<strong>Book of the Week</strong>
<span>Read the review</span>
</a>
<p>Do not place another interactive button inside this link.</p>
Let’s Understand the Example
- An a element becomes a working link when it has an href. Its visible text should tell readers where they will go.
- Strong marks text as particularly important. It means more than simply making words bold.
- Span groups a short piece of inline content without adding a new meaning by itself.
- Href contains the destination of a link. A value starting with # points to an id on the same page.
The first example link points to book.html. Check whether that destination exists relative to the document. A link changes where readers go; it does not perform an action such as saving a form.
What Should You See?
You should see a link named “Book of the Week Read the review”. Selecting it leads to book.html when that destination exists. Try it with the mouse and the keyboard.
Imagine this link is read out of context. Would its text still explain the destination? Rename unclear links before trying to make them look nicer with CSS.
Try It Yourself
- Design a card with a title link and a separate Edit button outside that link.
- Save your changes, open or refresh the page, and compare the result with the original example.
- Tell a friend what your change did. If you are not sure, undo it, refresh the page, and compare.
Common Beginner Mistakes
- Putting an Edit button inside a card link and creating conflicting click behavior.
- Avoid dead links, empty href values and clickable-looking text without a real destination.
Key Takeaways
- An anchor can contain several noninteractive items so a card acts as one navigation target.
- An a element becomes a working link when it has an href. Its visible text should tell readers where they will go.
- Prefer simple markup that gives the link a clear accessible name. Put an unrelated action button outside the card's anchor.