This is quite a simple but effective
What is a aspect ratio? The proportional relationship between the elements width and height, it is commonly present in video formats but depending on the case it can be seen in other places.
The most common ones are 4:3 Classic TV, 16:9 HD TV, 21:9 Cinemascope.
We can achieve the desired aspect ratio for an element by adding padding-top of an exact amount to reflect the needed ratio. This can change its width/height as the window's width changes maintaining the ratio.
- Aspect Ratio
- Padding Value
- padding-bottom: 56.25%
- padding-bottom: 75%
- padding-bottom: 66.66%
- padding-bottom: 62.5%