I'm looking for a way to keep the aspect ratio of a div fixed. I already found posts like this:
But these posts always expect the width to be given. I would like to specify a fixed ratio and then specify either height
or width
.
Examples:
<div class=fixed_ratio style="width: 50px;"></div>
<div class=fixed_ratio style="height: 50px;"></div>
Let's say the fixed_ratio
-class uses a fixed ratio of 1:5. The two lines above should result in two div
's (50px/250px, 10px/50px).
Is this even possible without javascript?