Check out example codes for "CSS shrink image". It will help you in understanding the concepts better.

Code Example 1

<!DOCTYPE html> 
        <title>cell padding</title>  
            .gfg { 
            img { 
                width: 100%; 
                height: 100%; 
                object-fit: contain; 
        <div class = "gfg"> 
                <p id="my-image"><img src= 

Code Example 2

squareImage {
  border: 1px solid #ddd;	/* thickness and color of border */
  border-radius: 4px;		/* edge rounding of border */
  width: 150px;				/* width of image (px or % or auto) */
  height: auto;				/* height of image (px or % or auto) */

Code Example 3

<div style="width: 200px; height: 200px;">
<img src="imagen\imagen1.jpg" style="width: 100px; height: 100px;"/>

Learn ReactJs, React Native from