xxxxxxxxxx
<style>
.center-role-form {
width: fit-content;
text-align: center;
margin: 1em auto;
display: table;
}
</style>
<div class="center-role-form">
<!--your div (contrent) place here-->
</div>
xxxxxxxxxx
/* margin auto does the magic, make sure to provide width less than 100% */
.center {
margin: auto;
width: 400px;
}
.center {
margin: auto;
width: 50%;
}