Created
March 6, 2025 15:18
-
-
Save laurelstreng/865cc4946ad4f57266b3a825b45647ed to your computer and use it in GitHub Desktop.
Add alternative text to pseudo elements
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
/** | |
* Adding alternative text for screen readers to pseudo elements. | |
* | |
* https://developer.mozilla.org/en-US/docs/Web/CSS/content#adding_an_image_with_alternative_text | |
**/ | |
.location { | |
&::before { | |
/* fallback content */ | |
content: url(images/backgrounds/location.svg) ' - Alt text is not supported'; | |
/* content with alternative text */ | |
content: url(images/backgrounds/location.svg) / ' Blue outlined location pin icon'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment