这是我在JSFIDDLE中的演示作品。
NB 不使用表格属性
我想让类.box
垂直居中。
CSS
.main{ height:300px; border:1px red solid;position:relative}
.box{width:40px; height:40px; background:red; }
/* for centering */
.box{ display: inline-block;position:relative; top:50% }
.main{ text-align: center; }
HTML
<div class="main">
<div class="box"></div>
</div>
top: calc(50% - 20px);
http://jsfiddle.net/tewathia/SxxWV/18/ - tewathia