日期:2014-05-17  浏览次数:20737 次

关于屏幕居中
想问下大家,网页中下面的版权信息不随屏幕大小的改变而移动一般是怎么做的啊,用CSS+DIV该怎么写,
 就像网易下面版权信息一样,不会随着屏幕的大小改变而移动,就是一直保持在一个位置.

------解决方案--------------------
HTML code

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>test</title>
<style>
html,body{width:100%;margin:0;}
</style>
</head>
<body>
<div id="piao" style="width:100%; height:50px; float:left;background:#F00;">这里是固定的</div>
<div style="height:2000px;"></div>
<script>
var ig=document.getElementById("piao");  
var isIE = (document.all) ? true : false;  
var isIE6 = isIE && ([/MSIE (\d)\.0/i.exec(navigator.userAgent)][0][1] == 6); 
var Bind = function(object, fun) {      
    return function() {
        return fun.apply(object, arguments);
    }
}
ig.style.position ="fixed"; //这里是非IE6下设置属性
ig.style.zIndex='1000';
ig.style.left='0';
ig.style.bottom='0';
if(isIE6){ //这里是IE6下设置属性
    ig.style.position ="absolute";
    ig._fixed = Bind(ig, function(){
    ig.style.marginTop = document.documentElement.scrollTop  + "px";
    ig.style.marginLeft = document.documentElement.scrollLeft + "px";});
    ig._fixed()
    window.attachEvent("onscroll", ig._fixed);
    }
</script>
</body>
</html>
是这种么?

------解决方案--------------------
居中
margin: 0 auto;
------解决方案--------------------
什么意思?
页面固定大小且居中?
a.上一级 text-align:center 
自身 margin:0 auto;
b. positaion:relative;width:700px;left:50%; margin-left:-350px;padding:0


------解决方案--------------------
居中,其它属性严格限制
------解决方案--------------------
width:expression
------解决方案--------------------
text-indent:center