Interview Question

What is aspect-ratio?

aspect-ratio supplies a preferred proportional relationship between width and height.

💡 Concept ✅ Quick Revision 🎨 CSS

Answer

The aspect-ratio property supplies a preferred width-to-height ratio. • It participates in automatic size calculations. • A replaced element may also use its natural aspect ratio. • Minimum and maximum size constraints can override the preferred ratio.

💡 Simple Example

.video { width: 100%; aspect-ratio: 16 / 9; }

⚡ Quick Revision

aspect-ratio supplies a preferred proportional relationship between width and height.