Open this example in the interactive library
Source code
<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>
Clip a swatch to a diamond with native CSS. The preview includes a small shared demo stylesheet.
Open this example in the interactive library
<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>