The ability to reply to discussions is limited to PRO members. Want to join in the discussion? Click here to subscribe now.

Control Image Aspect Ratio Using CSS

Control Image Aspect Ratio Using CSS

2:14
Resize images and videos to fill their parent and maintain their aspect ratio with pure CSS. The new `object-fit` and `object-position` properties allow you to scale images and videos, much like you could with `background-size` and `background-position`.
Watch this lesson now
Avatar
egghead.io

Resize images and videos to fill their parent and maintain their aspect ratio with pure CSS. The new object-fit and object-position properties allow you to scale images and videos, much like you could with background-size and background-position.

HEY, QUICK QUESTION!
Joel's Head
Why are we asking?