Check out example codes for "how to horizontal center a div in css". It will help you in understanding the concepts better.

Code Example 1

//HTML
<div class="parent">
	<span>Hello World</span>
</div>

//CSS
.parent {
  display: flex;
  justify-content: center;
  align-items: center;
}

Code Example 2

.parent {
  position: relative;
}
.child {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

Code Example 3

#inner {
  width: 50%;
  margin: 0 auto;
}

Learn ReactJs, React Native from akashmittal.com