![]() |
VOOZH | about |
CSS aspect ratio property is used to control the proportional relationship between the width and height of an element. It helps maintain the desired aspect ratio of elements, such as images, videos, and containers, regardless of their size or the size of the viewport.
Syntax:
aspect-ratio: auto | width/height | initial | inherit;Property Values:
Example 1: This example displays the image in aspect-ration 1 / 1.
Output:
👁 CSS aspect ratio propertyExample 2: This example displays the image in aspect-ration 16 / 9.
Output:
👁 CSS aspect ration property example outputSupported Browsers: