Skip to content

Instantly share code, notes, and snippets.

@nash403
Last active April 12, 2017 08:10
Show Gist options
  • Save nash403/8e98a9cdd57c48334ded6e6ef7147278 to your computer and use it in GitHub Desktop.
Save nash403/8e98a9cdd57c48334ded6e6ef7147278 to your computer and use it in GitHub Desktop.
hide image broken icon and replace it with alt content
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