css center text vertically and horizontally within a div

Center text vertically and horizontal within a div without wrapping the text. Making the line-height equals to the div height and set the vertial-align to middle.

.center {
 width: 100px;
 height: 100px;
 text-align: center;
 vertical-align: middle;
 line-height: 100px;
 font-size:50px;
}

Search within Codexpedia

Custom Search

Search the entire web

Custom Search