How to resize a video to fit within a specific area without losing the original aspect ratio? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to resize a video to fit within a specific area without losing the original aspect ratio?

Basically I have a non-resizable rectangle with a set width and height. I need to resize the video to fit within that rectangle without losing the original aspect ratio (which I'm calculating as width/height). Thank you for your help!

7th May 2017, 11:36 PM
Jad Haidar
Jad Haidar - avatar
2 Answers
+ 1
That would mess up the aspect ratio and make the video look stretched. Not the behavior I'm looking for.
8th May 2017, 12:31 AM
Jad Haidar
Jad Haidar - avatar
+ 1
try this in css video{ width:500px; height:auto; }
8th May 2017, 6:32 AM
MR Programmer
MR Programmer - avatar