SMRTR ProgrammingMay 28, 2026Go Make Things

How to add icons to external links with CSS

SMRTR summary

Use CSS attribute selectors with `:not()` and `:has()` to automatically style external links, excluding buttons, SVGs, and internal URLs. An SVG icon is injected via `::after` using `mask` and `background-color`, with alt text for accessibility.

SMRTR provides this summary for quick context. The original article belongs to Go Make Things.

Read the original article
SMRTR Programming

Get the next batch of curated summaries in your inbox.

This archive is built from SMRTR newsletter summaries. Subscribe for hand-picked stories without the extra noise.