87,922
社区成员
发帖
与我相关
我的任务
分享
<style>
#div_container
{
position: absolute;
width: 200px;
height: 200px;
left: 50%;
margin-left: expression(-( this . offsetWidth/ 2) + "px" );
background: red;
top:50%;
margin-top: expression(-( this . offsetHeight/ 2) + "px" );
}
</style>
<div id=div_container ></div>
<style>
#div_container
{
position: absolute;
width: 200px;
height: 200px;
background: red;
left: expression(document.body.clientWidth/2 -( this . offsetWidth/ 2) + "px" );
top: expression(document.body.clientHeight/2 -( this . offsetHeight/ 2) + "px" );
}
</style>
<div id=div_container ></div>