CSS论坛's Archiver

wolftears 发表于 2010-11-9 14:57

兼容各种浏览器的居中样式

兼容各种浏览器的居中样式
<html><head> <title>http://www.divcss5.com</title>
<style type="text/css">
.box{width:200px; height:200px; border:1px solid #000; position:fixed; left:50%; top:50%;margin-left:-100px;margin-top:-100px;_position:absolute;_top:expression(eval(document.documentElement.clientHeight/2+document.documentElement.scrollTop)); _left:expression(eval(document.documentElement.clientWidth/2+document.documentElement.scrollLeft); }
</style></head><body>
<div class="box">http://www.divcss5.com</div> </body></html>

wolftears 发表于 2010-11-22 09:02

兼容各种浏览器的居中样式

body{margin:0px;
          padding:0px;
          width:1024px;
          margin-left:auto;
          margin-right:auto;}
同时兼容safari

页: [1]

Powered by Discuz! Archiver 6.1.0  © 2001-2007 Comsenz Inc.