Dev Helpers

Tailwind CSS / Box model and sizing

Square aspect ratio

Dev Helpers · August 5, 2025

A square utility reserves stable thumbnail geometry. Pair it with an object-fit decision that preserves the part of the source image you need.

Worked example

<div class="demo w-24 aspect-square">Square aspect ratio</div>

Implementation notes

A square wrapper reserves layout space but does not describe the image to screen-reader users. Write alternative text for the content, or leave it empty for decoration.

Try it yourself

Compare a face near the edge of a portrait with a centred product.

Open the Tailwind CSS example →

Editorial date August 5, 2025 · Published December 6, 2026

Related articles

Maximum reading width

A max-width utility constrains a reading column even when its parent occupies the whole viewport. Font size still determines how many characters fit.

Content-box sizing

The box-content utility deliberately sizes the inner area. This can help when reproducing a measured content region with a separate frame.

Minimum inline size

Minimum width belongs to the element that must remain usable. A minimum on a parent can unnecessarily force the entire page to scroll.