mathematical problem

I need help to solve this simple mathematical problem:

Imagine we have an image at a 16:9 ratio.

From those two numbers (A:B), I need to get the “multiplier” that will bring me from A to B (from 16 to 9).

In this case, with 16:9, I figured out that the multiplier is close to 0.565 – 16 multiplied by 0.565 equals 9.04 …

My question is : *how* can I figure out what that multiplier is, knowing the starting point (16) and the end point (9)?

Why do I need this? I am building a video embedder, and want to define the correct ratio on the fly in CSS, based on the widht/height dimensions provided by the video API.


Just figured it out! It’s simply by making the division in the opposite direction, 9:16 … which gives 0.5652

So the formula is: divide height by width, then multiply by 100. This gives you the % value that you can apply to “padding-bottom” if you use this elegant CSS-based method.

One thought on “mathematical problem

Comments are closed.