-2

/Hi,

I found this post when looking for a way to keep the ratio of my pictures however I can't figure out a way to calculate accuratly the ratio of my pictures.

In this post he used 56.25% to make a ratio of 16/9, while I understand the maths (100/16*9), It doesn't seem to be the case if the height is larger than the width. any idea on how I should calculate that ?

Community
  • 1
  • 1
Brennan Sei
  • 1,033
  • 1
  • 9
  • 12

1 Answers1

2

You need to flip your ratio

  • 177.77777...% = 9/16 (vertical/portrait)
  • 56.25% = 16/9 (horizontal/landscape)
cimmanon
  • 67,211
  • 17
  • 165
  • 171
  • Hi, cimmanon, thanks for your help. I thought of that but I can't put 177% in padding-top, isn't there something missing to those maths ? – Brennan Sei Feb 18 '14 at 20:17
  • I don't understand why you can't. A `padding-top: 100%` would give you a square. Anything smaller than 100% creates a landscape box and anything larger than 100% creates a portrait box. – cimmanon Feb 18 '14 at 20:24
  • Oh sorry, I had my misunderstanding of the padding propriety. Thanks a lot ! – Brennan Sei Feb 18 '14 at 20:27