Skip to content
Type & iconsMarkdown

Image ratios

Media containers use five locked aspect ratios (1:1 · 4:3 · 16:9 · 4:5 · 9:16). Default Tailwind aspect utilities outside this set are blocked in theme.css.

Aspect ratio scale

RatioTailwindCSS varCSS valueUse
1:1aspect-square--aspect-square1 / 1Avatars, product tiles, square thumbnails
4:3aspect-4/3--aspect-4-34 / 3Editorial cards, documentation diagrams
16:9aspect-video--aspect-video16 / 9Widescreen video, hero media, demos
4:5aspect-4/5--aspect-4-54 / 5Portrait photography, vertical cards
9:16aspect-9/16--aspect-9-169 / 16Mobile-first vertical media, stories
1:1

aspect-square

4:3

aspect-4/3

16:9

aspect-video

4:5

aspect-4/5

9:16

aspect-9/16

Choose the ratio that matches the subject orientation so containers reserve space before images finish loading.

Usage

Apply aspect-ratio utilities in Tailwind CSS or custom properties in CSS:

<figure className="w-full max-w-sm overflow-hidden rounded-md border border-border bg-card">
  <img
    src="/diagram.png"
    alt="System architecture diagram"
    className="aspect-video w-full object-cover"
  />
</figure>
.card-media {
  aspect-ratio: var(--aspect-4-3);
  width: 100%;
  object-fit: cover;
}

Do and don't

Do: Lock media frames to the five allowed ratios
Apply aspect-square, aspect-4/3, aspect-video, aspect-4/5, or aspect-9/16 with object-cover so layout height is known before paint.
Don't: Use arbitrary or unapproved aspect ratios
Do not use aspect-auto, aspect-3/2, or aspect-21/9 because off-scale ratios cause inconsistent card heights and fail theme compilation.

Accessibility

  • Explicit aspect-ratio containers prevent Cumulative Layout Shift (CLS) as images load, keeping reading positions and focus targets stable.
  • Always provide descriptive alt text on informative images or alt="" on purely structural frames.

Rationale

Five standardized ratios cover square avatars, editorial cards, widescreen video, portrait cards, and vertical mobile media without ad-hoc cropping.