Advanced CSS Demo

Clip Path and Mask Image

Both properties hide parts of an element, but they do it in different ways. Clip paths create hard geometric edges, while masks create soft transparency.

Demo 1

Clip Path Shapes

Click each button to change the visible shape of the same image.

Sample photo for clip path demo
clip-path: circle(42%);

Demo 2

Clip Path Transition

Hover over the image. The polygon animates because both shapes use polygon() with the same number of points.

Sample photo showing a clip path transition
transition: clip-path 0.5s ease;

Demo 3

Gradient Mask Fade

This image uses a gradient mask so the bottom edge fades out instead of ending with a hard cut.

Sample landscape photo with a gradient mask fade
mask-image: linear-gradient(to bottom, black 55%, transparent 100%);

When to Use Which

Use clip-path when...

You need hard geometric shapes, angled sections, circles, diamonds, or polygon-based hover effects.

Use mask-image when...

You need soft fades, gradual transparency, vignettes, or image-based reveal effects.