网页绝对居中的方法和代码-三盈网络,深圳网站建设公司 
圈子资讯|咨询电话:183-2065-5007
网页绝对居中的方法和代码
时间:2010-05-07 00-00-00

网页在浏览器绝对居中的方法,代码如下:

方法一:

<div  style='position:absolute;left:expression((body.clientWidth-1000)/2);top:expression((body.clientHeight-600)/2);width:1000;height:600'>
<table width=1000 height=600 border=0 align=center cellpadding=0 cellspacing=0><tr><td>
页面内容
</td></tr></table>
</div>

方法二:

body,html{height:100%;padding:0;margin:0;}
<table width=100% height=100% border=0 align=center cellpadding=0 cellspacing=0><tr><td>
<table width=800 height=600 border=0 align=center><tr><td>
页面内容
</td></tr></table>
</td></tr></table>

其中网页绝对居中方法一中的代码,层和表格里的width和height前后需对应;绝对居中方法二是采用表格居中属性来实现,用CSS定义外表格宽和高均为浏览器的100%,然后内表格居中于外表格TD即可。


联系我们contact us
  • 18320655007
  • 13924654107(朱经理)
  • 13927414511
  • 460584196@qq.com
  • 深圳市宝安区西乡街道前进二路93号彩虹城4楼B95
  • 信宜市实验学校旁三盈网络
三盈网络科技有限公司 © 版权所有 粤ICP备2023040535号
主营业务:全网营销网站,外贸网站,抖音推广,爱采购,网页设计,全网营销方案