vertical text align in div code example

Example 1: css align items vertical center

.parent {
  display: flex;
  justify-content: center;
  align-items: center;
}

Example 2: css align text vertically

/* HTML: */
<div class="text">
lorem ipsum
</div>


/* CSS: */
.text {
vertical-align: middle;
/*can take any value of:
baseline | sub | super | text-top | text-bottom | middle | top | bottom | <percentage> | <length> */
}

Example 3: center align css

text-align: center;

Example 4: vertical align text inside div

text {
  	line-height: 100px; /*size of parent div*/ 
}

Tags:

Html Example