Dev Helpers

CSS / Transforms and motion

Rotate a swatch

Dev Helpers · October 11, 2025

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

Related articles

Fluid width with a maximum

A fluid container needs a small-screen width and a large-screen maximum. Outer gutters should remain visible at both extremes.

Square aspect ratio

A square ratio reserves equal sides even before media loads. Fit rules decide whether rectangular content is cropped or letterboxed.