You may think it was duplicated, but I don't thinks so, because I'm talking about tables not images!
I tried to set a table in center of div horizontally and vertically with the below codes. The codes work fine for images but when I put a table instead of image, it seems it can not see the tables and then put the span size to 100% and table display below of div not in center of div.
Codes:
<style>
.wraptocenter {
display: table-cell;
text-align: center;
vertical-align: middle;
width:155px;
height: 160px;
background-color:#999;
display: block;
}
.wraptocenter * {
vertical-align: middle;
}
.wraptocenter span {
display: inline-block;
height: 100%;
width: 1px;
}
</style>
<!--[if lt IE 8]><style>
.wraptocenter span {
display: inline-block;
height: 100%;
}
</style><![endif]-->
<div class="wraptocenter">
<span></span>
<table border="1" width=" 70%">
<tr height="10px">
<td width="10px" height="10px"></td>
<td width="10px" height="10px"></td>
</tr>
<tr height="10px">
<td height="10px"></td>
<td height="10px"></td>
</tr>
</table>
</div>
If you put a images every thing work fine but for tables NOT!