vertical-align: middle doesn’t work

You must wrap your element in a table-cell, within a table using display.

Like this:

<div>
  <span class="twoline">Two line text</span>
  <span class="float">Float right</span>
</div>

and

.float {
    display: table-cell;
    vertical-align: middle;
    text-align: right;
}
.twoline {
    width: 50px;
    display: table-cell;
}
div {
    display: table;
    border: solid 1px blue;
    width: 500px;
    height: 100px;
}

Shown here: http://jsfiddle.net/e8ESb/7/

Leave a Comment