A CSS Shadow Can Expose Opaque Pixels Hidden in an Icon Asset

A shadow that follows a rectangular image box looks different from one tracing an icon's visible shape, and a solid rectangular silhouette may indicate opaque pixels in the file rather than a CSS fault. The article points to MDN's drop-shadow documentation, which explains that the filter relies on the image's alpha mask, and suggests comparing it with a standard box shadow. It warns that a white rectangle stored in the asset can distort the filtered silhouette, and that aggressively converting white to transparent may remove intended white details such as eyes or small labels. To separate source problems from styling effects, the author recommends testing the asset on a contrasting background without component styles, checking it at actual icon size, and keeping the unmodified file for comparison. Changing one asset at a time with consistent dimensions and shadow settings helps identify which file holds the problem.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in