Text Center Ver & Hor

Text center in a div both vertically and horizontally :

Html :

<div class="center">

  <p>I am vertically and horizontally centered.</p>

</div>

Css:

.center {

  display: flex;

  justify-content: center;

  align-items: center;

  height: 200px;

  border: 3px solid green; 

}

Comments