1×
Become a member
to unlock all features
Autoplay

    Control Image Aspect Ratio Using CSS

    cssCSS

    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.