1/* Using flex to center anything*/
2.parent{
3 display: flex;
4 justify-content: center; /* Centering Horizantly */
5 align-items: center; /* Centering Vertically */
6 /* Every element inside this div will be centered*/
7}
8/* Using Line Height*/
9.main-div{
10 width: 50%;
11 height: 40px;
12}
13.main-div p{
14 line-height: 40px; /* Same as parent height*/
15 /* p will be centered vertically inside its parent div*/
16}
17/* CSS Property */
18p{
19 text-align: center;
20}