Rotation changes painting and hit testing while preserving the element's original layout footprint. Leave enough room for the rotated corners.
Worked example
<style>
.demo {
width: fit-content;
rotate: -6deg;
}
</style>
<div class="demo">Rotate a swatch</div>Implementation notes
Rotation changes the visual alignment of small strokes and text. Check the final rendering at ordinary device pixel ratios before adding more transforms.
Try it yourself
Put adjacent swatches close together and focus each one.
Open the CSS example →Editorial date October 11, 2025 · Published December 6, 2026