A Practical Guide to Aspect Ratio in CSS

VideoZoran Jambor

A practical, hands-on guide to using aspect ratio in CSS.

With CSS aspect-ratio property, supported in all modern browsers, you will no longer need to resort to padding hack to maintain the proportional dimensions of an element.

Chapters

  • 00:00 Intro
  • 00:22 How aspect-ratio property works
  • 01:57 How padding hack works
  • 03:04 An example with the aspect-ratio property
  • 04:01 Using "auto" value with aspect-ratio property
  • 05:53 Setting aspect ratio on an iframe
  • 07:34 What exactly preferred aspect ratio means
  • 08:21 How aspect-radio media query works
  • 09:44 Conclusion

Demo

Links

CSS Stickers

CSS Stickers

A set of beautiful, cute, and funny CSS stickers to showcase your love for CSS.

Get Your Set Today »
CSS Weekly YouTube Channel

CSS Weekly YouTube Channel

Weekly hands-on tutorials, tips, tools, news, and more — everything related to CSS and front-end development, created by Zoran Jambor.

Subscribe Today »