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

Code Example 1

.center {
  display: block;
  margin-left: auto;
  margin-right: auto;
}

Code Example 2

.centerImg {
  display: block;
  margin: 0 auto;
}

Code Example 3

.center {
  display: block;
  
  margin-left: auto;
  margin-right: auto;
  
  width: 50%;
}

Code Example 4

.center {
  margin: 0;
  position: absolute;
  top: 50%;
  left: 50%;
  -ms-transform: translate(-50%, -50%);
  transform: translate(-50%, -50%);
}

Code Example 5

<div style="text-align: center;">
  <img scr='img/example.jpg'>
</div>

Code Example 6

.someclass {
  display: block;
  margin-left: auto;
  margin-right: auto;
}

Learn ReactJs, React Native from akashmittal.com