Here is a common approach used for vertical/horizontal centering.
BASIC EXAMPLE HERE
div {
background: red;
width:100px;
height: 100px;
display:table;
}
div > span {
display:table-cell;
vertical-align:middle;
text-align:center;
}
Basically, the parent element's display is changed to table
. Add in a child element, in this case a span
element to wrap the text. The span
should have the properties display:table-cell
/vertical-align:middle
for vertical centering. Then text-align:center
is simply for horizontal centering.
Here is an example using the styling you had.