1.container {
2 display: flex;
3 justify-content: center;
4 align-items: center;
5}
1<div class="container">
2 <div class="child"></div>
3</div>
4.container {
5 ...
6 display: flex;
7 justify-content: center;
8 align-items: center;
9}
1.parent {
2 position: relative;
3}
4.child {
5 position: absolute;
6 left: 50%;
7 top: 50%;
8 transform: translate(-50%, -50%);
9}
1.center {
2 text-align: center;
3}
4
5// or
6
7<div style="text-align:center">
8</div>