Search

Aspect ratio

Aspect ratio with CSS

Maintaining aspect ratio in a web design layout is especially useful when it comes to images and videos. The CSS aspect-ratio property easily takes care of this challenge. Let’s say we have a photo that we want fixed at a 16:9 aspect ratio. The HTML might look like this: