Last active
January 16, 2024 21:01
-
-
Save ryanmorr/5a99dc63421504b0c357023553eebe81 to your computer and use it in GitHub Desktop.
Allow an SVG icon to seamlessly blend with text
This file contains 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
/* Courtesy of: https://www.24a11y.com/2018/accessible-svg-icons-with-inline-sprites/ */ | |
.svg-icon { | |
/* Place the icon on the text baseline. */ | |
position: relative; | |
top: .125em; | |
/* Prevent the icon from shrinking inside a flex container. */ | |
flex-shrink: 0; | |
/* Scale the icon to match the font-size. */ | |
height: 1em; | |
width: 1em; | |
/* Let the icon take whatever color the parent has. */ | |
fill: currentColor; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment