<HTML>
<script>
function divcenter(){
document.all.mxh.style.left=(Math.round((document.body.scrollWidth-200)/2)).toString()+"px"
}
</script>
<body onload="divcenter()" onresize=divcenter()>
<table width=100%>
<tr>
<td>test
</td>
</tr>
</table>
<div id=mxh style="position:absolute;left:200px;top:30px;width:200px;height:200px;background-color:navy;border:2px;color:#FFFFFF">测试文字</div>
</HTML>
<script>
function divcenter(){
document.all.mxh.style.left=(Math.round((document.body.scrollWidth-200)/2)).toString()+"px"
}
</script>
<body onload="divcenter()" onresize=divcenter()>
<table width=100%>
<tr>
<td>test
</td>
</tr>
</table>
<div id=mxh style="position:absolute;left:200px;top:30px;width:200px;height:200px;background-color:navy;border:2px;color:#FFFFFF">测试文字</div>
</HTML>
也可以外边用一个position:absolute;套在在里边的元素用一个position:relative;
http://colorweb.go.163.com/main.html