On this page
  1. aspect-ratio
  2. Syntax & Overview
  3. Notes & Best Practices
  4. Example

aspect-ratio

Prev: `padding` | Up: box_model | Next: `overflow`
Rel: box_model, Box Model & Sizing Guide
Ref: MDN Web Docs — aspect-ratio
Tags: #public #web #css #properties #box_model #tier/core


Syntax & Overview

aspect-ratio: 16 / 9;

Declares a preferred width-to-height ratio for responsive boxes and media.

Notes & Best Practices

Example

.thumbnail {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

Linked from

Related notes