I have 2 divs that I want to centre vertically inside another div. At the moment I have:
http://jsfiddle.net/5vpA3/1/
Now I understand what is going on here, but
Live Demo
float: left
from #left
and #right
.Instead, use display: inline-block
:
#left, #right {
display: inline-block;
vertical-align: middle;
}
display: inline-block
, you have to deal with the whitespace issue. I chose to remove the whitespace in the HTML between
. See here for what happens if you don't do that. Removing the whitespace really is the easiest fix, but there are other ways.