3 ms·
Yes, but it still has a meaning, and it is not "icon". I think you can be pragmatic here and use <i>, since it to my knowledge doesn't cause any real world prob
by jacobr 14y ago
Yes, but it still has a meaning, and it is not "icon". I think you can be pragmatic here and use <i>, since it to my knowledge doesn't cause any real world problem, but it's worth exploring other options.
<img src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" class="i-icon" alt="Kitten">
.i-icon {
width: 32px;
height: 32px;
background-image: url(http://placekitten.com/32/32);
}
The src is the data uri of a transparent gif. Screen readers will hear the alt text if you supply one. This will not work with font icons (img can't have ::before or ::after) but it should work fine for sprites or data uris in the CSS.