1 min readSep 13, 2020
Another trick to keep the proportions of the original image (in case container height doesn’t or shouldn’t span 100%) is to set bottom padding. I.e. for 16/9 ratio, set bottom padding to 9/16 = 0.5625 = 56.25%. 2/1 = 50%. 3/4 = 75% and so on.