[原创] 纯css漂浮广告页面垂直居中(兼容IE6、IE7、Firefox2.0)

CSS:
1#adflcenter { left: 0px; right: 0px; top: 25%; *top: 50%; position: fixed; }
2* html #adflcenter {  position: absolute; padding: 0px 10px; top: expression(offsetParent.scrollTop + screen.availHeight/2.22); }
3#adflcenter div { position: relative; top: -50%; margin: 0px auto; }
 
HTML:
1<div id="adflcenter"><div style="height: 300px; width: 760px;"></div></div>
 
注:需要设置外部div的高度,内部div的高度和宽度。
 
 
如页面无声明页面类型,则使用以下CSS代码(在大于1024x768分辨率的情况下会偏离居中)
1#adflcenter { height: 0px; left: 13%; top: 25%; position: fixed; }
2* html #adflcenter {  position: absolute; padding: 0px 10px; top: expression(offsetParent.scrollTop + screen.availHeight/2.22); }
3#adflcenter div { position: relative; top: -50%; left: -25% margin: 0px auto; }

posted on 2008-06-23 10:16  kilobug  阅读(667)  评论(0编辑  收藏  举报