clipPath vs. mask: all-or-nothing versus partial transparency
SVG's clipPath element and CSS's clip-path property are easily confused with masks, and a short explainer from viewBox lays out the distinction between them.
The core difference is that clipping is vector-based, so anything being clipped is either in or out. A mask can also produce partial transparency, which means a gradient can, for instance, fade out the masked element. From that, it follows that masks are the more powerful of the two, since they can do everything a clip path does and more.
Masks come in two styles. A luminance-style mask reads white as transparent, black as opaque, and everything in between as partially transparent. An alpha-style mask uses the alpha channel of each pixel as the alpha-ness of the mask. That description sounds clear enough on paper, but applying it to an actual element can feel reversed and confusing.
For a deeper treatment of the topic, the source points to Sarah's post on masking versus clipping. The viewBox tip is available directly at viewbox.club.



