Computer >> Computer tutorials >  >> Programming >> Javascript

Vertical align text in a block element with HTML


As per the official specification, declare the <a> as a flex container and you need to use align-items to vertically align text along the cross axis.

display: flex;
align-items: center;

You can also go to −

display: -moz-box;
-moz-box-align: center;

The following is the image showing the usage of Flexbox −

Vertical align text in a block element with HTML