Check out example codes for "keep aspect ratio of image css". It will help you in understanding the concepts better.

Code Example 1

.container {
  padding-top: 62.5%; /* 
8:5 Aspect 
Ratio (divide 5 by 8 = 0.625) */
}

Code Example 2

.container {
  padding-top: 75%; /* 
4:3 Aspect 
Ratio (divide 3 by 4 = 0.75)  */
}

Code Example 3

img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
}

Learn ReactJs, React Native from akashmittal.com