It’s obviously best to avoid broken images at all costs as it hurts the user experience, SEO, layout, etc, but I found this CSS pseudo-element “loophole” interesting for those cases where you may have unpredictable missing images. For instance, when moving a site to a new server or for externally hosted images that are removed from the web.

Broken images are ugly. But they don’t always have to be. We can use CSS to apply styles to the element to provide a better experience than the default. Two Facts About The Element To understand how we can style broken images, there

Source: Styling Broken Images