CSS: Vertical align content of an element -


i need vertical align span, thing makes complicated span needs occupy whole parent. jsfiddle

so, html is

<div>     <span>ok</span> </div> 

css:

div {      width: 200px;      height: 200px;      background-color: lightgrey; }  span {     display: block;     width: 100%;     height: 100%;     vertical-align: middle; } 

is possible without changing html ?

update: although below answers correct , interesting, chose 1 used correct one!

tell behave table:

div {     width: 200px;     height: 200px;     background-color: lightgrey;     display: table; } span {     display: table-cell;     text-align: center;     vertical-align: middle; } 

http://jsfiddle.net/9uae6/2/


Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -