If you wish to get a fully centered content you might have some times problems.
I tried multiple times to use javascript and other script like jQuery to fully center a content. But there is an easier way: CSS
The next code can help you center everything. You must follow the HTML code presented bellow:
<div class="centeringdiv"> <div class="child">What is here is centered</div> </div>
.centeringdiv { display: flex; justify-content: center; align-items: center; height: 100px; }