<div class="container">
<img src="http://bitsofco.de/broken.jpg" alt="Kanye Laughing" class="broken-1">
<img src="http://bitsofco.de/broken.jpg" alt="Kanye Laughing" class="broken-2" />
<img src="http://bitsofco.de/broken.jpg" alt="Kanye Laughing" class="broken-3" />
<img src="http://bitsofco.de/content/images/2016/02/kanye.jpg" alt="Kanye Laughing" class="broken-1 broken-2 broken-3">
</div>
@import url("https://fonts.googleapis.com/css2?family=Exo:wght@600&display=swap");
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
width: 100vw;
min-height: 100vh;
font-family: "Exo", Arial, sans-serif;
background-color: #557;
color: #fff;
display: grid;
padding: 30px;
gap: 30px;
place-content:start center;
}
.container {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
gap: 30px;
align-items: start;
}
img {
font-family: "Exo", Arial, sans-serif;
font-weight: 300;
line-height: 2;
text-align: center;
width: 100%;
height: auto;
display: block;
position: relative;
margin-bottom: 100px;
}
/* Style One */
img.broken-1:before {
content: "We're sorry, the image below is broken :(";
display: block;
margin-bottom: 10px;
}
img.broken-1:after {
content: "(url: " attr(src) ")";
display: block;
font-size: 12px;
}
/* Style Two */
img.broken-2 {
position: relative;
}
img.broken-2:after {
content: "\f1c5" " " attr(alt);
font-size: 16px;
font-family: FontAwesome;
color: rgb(100, 100, 100);
display: block;
position: absolute;
z-index: 2;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: #fff;
}
/* Style Three */
img.broken-3 {
position: relative;
min-height: 50px;
}
img.broken-3:before {
content: " ";
display: block;
position: absolute;
top: -10px;
left: 0;
height: calc(100% + 10px);
width: 100%;
background-color: rgb(235, 235, 235);
border: 2px dotted rgb(200, 200, 200);
border-radius: 5px;
}
img.broken-3:after {
content: "\f127" " Broken Image (" attr(alt) ")";
display: block;
font-size: 16px;
font-style: normal;
font-family: FontAwesome;
color: rgb(100, 100, 100);
position: absolute;
top: 5px;
left: 0;
width: 100%;
text-align: center;
}
body {
text-align: center;
}
.container {
max-width: 800px;
width: 100%;
padding: 50px;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.