Overview
Use aspect ratio utilities to maintain consistent proportions for elements like images, videos, and containers. These utilities ensure elements maintain their intended shape across different screen sizes.Aspect Ratio Utilities
| Class | Ratio | CSS | Usage |
|---|---|---|---|
.aspect-square | 1:1 | aspect-ratio: 1 / 1; | Square aspect ratio |
.aspect-video | 16:9 | aspect-ratio: 16 / 9; | Video aspect ratio |
Aspect Square
Use.aspect-square to create a 1:1 square aspect ratio. Perfect for avatars, thumbnails, and card images that need to be square.
Common Use Cases
- Avatar images
- Thumbnail grids
- Square card images
- Icon containers
- Profile pictures
Aspect Video
Use.aspect-video to create a 16:9 aspect ratio, the standard for video content. Perfect for video embeds, hero images, and media containers.
Common Use Cases
- Video embeds
- Hero image containers
- Media galleries
- YouTube/Vimeo iframes
- Responsive video containers
Aspect Ratio Examples
Square Image Grid
Video Hero Section
Responsive Card with Square Image
Gallery with Mixed Aspect Ratios
Best Practices
1
Combine with Object Fit
Use aspect ratio utilities with
.object-cover or .object-contain to control how content fills the container.2
Use Square for Thumbnails
Use
.aspect-square for consistent thumbnail grids and avatar images.3
Use Video for Media
Use
.aspect-video for video embeds and media containers to maintain proper proportions.4
Set Container Width
Always set a width on the container when using aspect ratio utilities to control the size.

