Created
March 17, 2026 15:15
-
-
Save DavesCodeMusings/b1e04ca13b30c17f34193d31dfacd0c7 to your computer and use it in GitHub Desktop.
CSS attr() function and the ::after pseudo element used to dynamically display link title after link text
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>Test</title> | |
| <style> | |
| a { | |
| text-decoration: none; | |
| } | |
| a:hover { | |
| text-decoration: underline; | |
| } | |
| a::after { | |
| content: " " attr(title); | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <p>Whoa, oh, oh, oh, oh. Whoa, oh, oh, oh, | |
| <a href="https://www.azlyrics.com/lyrics/imaginedragons/personal-radioactivity.html" title="I'm Radioactive">☢</a>, | |
| <a href="https://www.azlyrics.com/lyrics/imaginedragons/general-radioactivity.html" title="Radioactive">☢</a>. | |
| <!-- The link title (Radioactive) is appended after the unicode radiation symbol (x2622) using CSS style --> | |
| </p> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment