纯CSS实现上下左右都居中的代码 #box{width:600px; height:400px; border:1px solid red;} #box{position:static; *position:relative; display:table; *display:block; } #box-middle{position:static; *position:absolute; display:table-cell; *display:block; *top:50%; vertical-align:middle; *vertical-align:auto;} #box-inner{position:relative; top:-50%; background-color:blue; margin:0 auto; width:200px; height:100px;} content [Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]终于见识了这个变态的IE7,象雾象雨又象风,IE系列的CSS hack: * html它认;Firefox的CSS hack: html>body、#id[id]、html[xmlns] div这样的东东它也认,教我说它什么好呢! 最终通过无敌 * 解决了它!