//IE6、IE7都无效
<div style="display:table-cell;vertical-align:middle; text-align:center;150px;height:150px;border:1px solid red">
<div style="display:inline-block;50px;height:50px;background:red">agrga</div>
</div>
<div style="position:relative;border:1px solid red">
<div style="100px;height:100px;position:absolute;left:50%;top:50%;margin-top:-50px;margin-left:-50px;background:red">gfgasdg</div>
</div>
//支持IE9+,谷歌,火狐等符合w3c标准的现代浏览器
<div style="position:relative;border:1px solid red">
<div style="100px;height:100px;position:absolute;left:0;top:0;bottom:0;right:0;margin:auto;background:red">agagg</div>
</div>
<div style="position:relative;float: left;left: 50%;border:1px solid red">
<div style="position: relative;left: -50%;background:red">ggds</div>
</div>
相关文章:http://www.cnblogs.com/2050/p/3392803.html