I am trying to solve a rectangle problem using jQuery. Basically, I have 3 square boxes which fix inside a larger box.
I know the larger box has a max-width of 500px. I do not know what the sizes of 1, 2 or 3 will be – but I know that their aspect ratio’s can change and that they must fit proportionally into the box.
How would I go about always ensuring that no matter what shape – the 3 rectangles are always proportionally sized inside the 500px box ?
After solving the system of equations, I believe the following is true.
500 px, a1, a2, and a3 are knowns. Solve for w1, then w2, and w3. Use a1,a2, and a3 to determine h1, h2, and h3.
I believe your algorithm should be:
Here are the steps I followed