Files
30-seconds-of-code/snippets/display-empty-links.md
2022-11-05 13:01:58 +02:00

573 B

title, tags, expertise, author, cover, firstSeen
title tags expertise author cover firstSeen
Style links with no text visual beginner chalarangelo blog_images/metro-tunnel.jpg 2022-11-11T05:00:00-04:00

Displays the link URL for links with no text.

  • Use the :empty pseudo-class to select links with no text.
  • Use the :not pseudo-class to exclude links with text.
  • Use the content property and the attr() function to display the link URL in the ::before pseudo-element.
<a href="https://30secondsofcode.org"></a>
a[href^="http"]:empty::before {
  content: attr(href);
}