Vertically Align Text With Flexbox

Vertically Align With Flexbox

Centering a text or detail vertically has usually been pretty a ache for lots front-end developers. Introduced inside the CSS3 specification, the display: flex property/fee offers an easy manner to vertically align any detail.

HTML

 <div class="align-vertically">
    <h1>I am vertically Middle!</h1>
  </div>

CSS

<style type="text/css">
  .align-vertically {
    background: #13b5ea;
    color: #fff;
    display: flex;
    align-items: center;
    height: 200px;
	padding:10px;
}
</style>

Leave a Reply

avatar
  Subscribe  
Notify of