Skip to content

Instantly share code, notes, and snippets.

@huzefamehidpurwala
Created May 31, 2024 11:25
Show Gist options
  • Save huzefamehidpurwala/2c362f7af76a9a964d2ebddfda970457 to your computer and use it in GitHub Desktop.
Save huzefamehidpurwala/2c362f7af76a9a964d2ebddfda970457 to your computer and use it in GitHub Desktop.
img alt html/css
/* https://stackoverflow.com/questions/22051573/how-to-hide-image-broken-icon-using-only-css-html */
.image {
position: relative;
// height: 70px;
width: 70px;
img {
border-radius: 50%;
height: 70px;
width: 70px;
&[alt]::after {
border-radius: 50%;
border: 1px solid #000; /* outset */
display: block;
position: absolute;
top: -26px;
left: 0;
height: 70px;
width: 70px;
background-color: #fff; // #107c10;
color: #000;
font-weight: 300;
font-size: 30px;
// line-height: 2;
// text-align: center;
display: flex;
align-items: center;
justify-content: center;
content: attr(alt);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment