Style broken images

No one likes broken images on their site, right? With this #CSS tip you make a more aesthetically pleasing display if you happen to have a broken image on your website with a few lines of code. This works because normally since an image is an external resource the :before and :after pseudo-elements shouldn’t work, but when the image is broken, it is actually not an external resource and the pseudo elements appear. So we can apply styles to only broken images and not an image that shows up.

broken-image-css

broken-image-html

Instagram Post