<div style="height:100px;background-color:#888;"><!-- The dic to align vertically -->
<div style="display: table;width: 100%;height: 100%;">
<div style="display: table-cell;vertical-align: middle;">Text</div>
</div>
</div>
Div Align
Align two div s (next to) like a table (same height) .the_div_1 ,the_div_2{ display: table-cell;verticle-align:top;}
NOTE : Once set to table-cell, you can also use verticle-align:
Verticle-Align Property
This property works with: (top, middle,bottom ...)
Table (table td)
div with table-cell (display: table-cell;)
div with line-height
Verticle position adjustable propertys
line-height:
display:
margin-top: margin-bottom:
padding: (top & bottom)
border: (top & bottom)
font-size:
verticle-align:
position: relative / absolute (try to avoid absolute, if using set a relative just before, except for the body)
Comments