xxxxxxxxxx
// add to the parent element
.parent {
display: grid;
place-items: center;
}
xxxxxxxxxx
.element {
position: absoloute;
margin: auto;
left: 0;
right: 0;
top: 0;
bottom: 0;
}
xxxxxxxxxx
<style>
#para {
margin-left: auto;
margin-right: auto;
width: 8em
}
</style>
<P id="para">This is a paragraph </p>
xxxxxxxxxx
element {display: block; float: left; vertical-align: middle; text-align: center}