Vertical align text in a block element with HTML

Web DevelopmentJavascriptFront End Scripts

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 −

raja
Published on 05-Apr-2018 12:30:50
Advertisements