CSS masking is an incredibly powerful layout technique. Learn how to implement beautiful, scalable shapes for arbitrary images, safely design custom shapes for text components, or use pure CSS gradients.
The SVG mask is applied directly to the image element. The mask scales automatically to the shape bounds
using objectBoundingBox. Hover to see scale and tone animations.
Applying a mask to the text element directly would crop your content. Instead, we mask an empty div placed adjacent to the text block. Sharing the same background color makes them look like one unified shaped card.
Building robust responsive design patterns using modern web platform APIs.
For simple shapes, you can define linear or radial gradients directly in CSS. The dot pattern background shines right through the transparent semi-circular notch cut out along the top edge.
The background pattern is visible through the top notch, created using a single CSS radial-gradient.