In order to target a div you can do so by id or by class, for example
<div id="centerme" class="centerit">some content</div>
here is the css:
#centerme {
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
/* in some cases you may want to give it a width and height first */
height:100%;
max-height: 10rem;
width: 100%;
max-height: 20rem;
}
/* another option only vertical via class rather than id */
.centerit {
top: 50%;
transform: translateY(-50%);
}
/* or only horizontal */
.centerit {
left: 50%;
transform: translateX(-50%);
}
That's it!