Let’s see the example on horizontally aligning the text using text-align: center as shown in the below pen.
To vertically align the text for a single line of text we can use the following technique.
Trick 1 : set the line-height = height of the element to vertically align the single line as shown below.
If you have two lines then you can use the following markup. And you can generalize the following markup for multiple lines.