Use checker background 1) always; or 2) for image filetypes that support transparency (e.g. gif, png, webp, perhaps there are even more). Run the following code on https://www.falkon.org/images/screenshot.png for (let i = 0; i < fileType.length; i++) { if (document.contentType.match(fileType[i])) { // 808080 525c66 dddddd // Source: /questions/35361986/css-gradient-checkerboard-pattern document.body.style.backgroundImage = 'linear-gradient(45deg, #a3a3a3 25%, transparent 25%), linear-gradient(-45deg, #a3a3a3 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #a3a3a3 75%), linear-gradient(-45deg, transparent 75%, #a3a3a3 75%)'; document.body.style.backgroundSize = '20px 20px'; document.body.style.backgroundPosition = '0 0, 0 10px, 10px -10px, -10px 0px'; } }