bit Bheadless

Aspect Ratio

Displays content within a desired ratio, regardless of the content's intrinsic size.

Implementation: CSS Tailwind

Basic (16 / 9)

Wrap any content in BitBhAspectRatio and set Ratio to the desired width / height. The image fills the box at a constant 16:9 ratio no matter how wide the column gets.

Landscape photograph

Square (1 / 1)

The default ratio is 1 — a perfect square. Useful for avatars and thumbnails. You can omit the Ratio parameter entirely.

Portrait photograph

Portrait (3 / 4)

Ratios smaller than 1 produce taller-than-wide boxes. Here 3 / 4 creates a portrait frame.

Portrait photograph

Non-image content

The ratio box isn't limited to images — drop in any content. The inner element is absolutely positioned to fill the reserved space, so flex centring works as expected.

2 : 1
An unhandled error has occurred. Reload 🗙