Last active
April 12, 2017 08:10
-
-
Save nash403/8e98a9cdd57c48334ded6e6ef7147278 to your computer and use it in GitHub Desktop.
hide image broken icon and replace it with alt content
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
img[alt] { | |
position: relative; | |
&:after { | |
display: block; | |
position: absolute; | |
top: 0; | |
left: 0; | |
width: 100%; | |
height: 100%; | |
/* Add bg color and the text of the alt attribute in place of the broken image */ | |
background-color: #999; | |
font-family: 'Helvetica'; | |
font-weight: 300; | |
line-height: 2; | |
text-align: center; | |
content: attr(alt); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment