A polygon clip can turn a square swatch into a diamond while its allocated layout box stays rectangular.
Worked example
<style>
.demo {
width: 6rem;
height: 6rem;
clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}
</style>
<div class="demo" aria-hidden="true"></div>Implementation notes
Polygon points are relative to the reference box. A non-square box stretches a diamond, so give the shape the ratio its design assumes.
Try it yourself
Tab through nearby controls and inspect the space around the clipped shape.
Open the CSS example →Editorial date November 21, 2025 · Published December 6, 2026