Check out example codes for "scale an image css". It will help you in understanding the concepts better.

Code Example 1

<!DOCTYPE html> 
<html>  
    <head>  
        <title>cell padding</title>  
        <style>  
            .gfg { 
                width:auto; 
                text-align:center; 
                padding:20px; 
            } 
            img { 
                width: 100%; 
                height: 100%; 
                object-fit: contain; 
            } 
        </style>  
    </head>  
    <body>  
        <div class = "gfg"> 
                <p id="my-image"><img src= 
"https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-17.png"> 
            </p> 
        </div> 
    </body>  
</html>                    

Learn ReactJs, React Native from akashmittal.com