Aspect Ratio Box Generator
Create responsive containers that maintain aspect ratios for images, videos, embeds, and content boxes.
Presets
Aspect Ratio
16:9 = 1.778
Method
Sizing
Content Settings
Responsive
Save/Load
Preview
Ratio:16:9
Decimal:1.7778
Padding %:56.2500%
Generated CSS
/* Modern aspect-ratio property (Chrome 88+, Firefox 89+, Safari 15+) */
.aspect-ratio-box {
aspect-ratio: 16 / 9;
width: 100%;
max-width: 800px;
min-width: 200px;
overflow: hidden;
position: relative;
}
.aspect-ratio-box > * {
width: 100%;
height: 100%;
object-fit: cover;
object-position: center center;
}
HTML Template
<div class="aspect-ratio-box">
<img src="your-image.jpg" alt="Description" />
</div>Aspect Ratio Reference
Common Aspect Ratios
- 1:1 - Square (Instagram, profile photos)
- 4:3 - Classic TV, older displays
- 16:9 - Widescreen HD (YouTube, most videos)
- 21:9 - Ultrawide, cinematic
- 9:16 - Vertical video (Stories, Reels)
- 3:2 - Standard photography
Methods Comparison
- aspect-ratio - Modern CSS, cleaner code, good support
- padding-bottom - Legacy support, works everywhere
- Use aspect-ratio for new projects
- Use padding-bottom for IE11/older browser support
Object Fit Values
- cover - Fill container, crop if needed
- contain - Fit entirely, may show background
- fill - Stretch to fill (may distort)
- none - Original size, may overflow
- scale-down - Like contain, but never upscale
Use Cases
- Responsive image galleries
- Video embed containers
- Card thumbnails
- Hero banners
- Product image grids
- Avatar placeholders