前几天太忙了,现在终于抽出时间,来分享一下:ie6下position:fixed;
目前找了两种方法,整理了一下,
方法一:
给你想要固定的元素定义一个样式
#fixed{height:30px; position:fixed; _position: absolute;bottom:0; _bottom:auto; _top:expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight-this.offsetHeight-(parseInt(this.currentStyle.marginTop,10)||0)-(parseInt(this.currentStyle.marginBottom,10)||0)));}
红色部分为为必填选项;
方法二:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>position:fixed ie6</title>
<style type="text/css">
*{margin:0;padding:0;}
body{}
#fixed{position:fixed;top:5em;right:0;background:#fff;color:#000;}
</style>
<!--[if IE 6]>
<style type="text/css">
html{ overflow:hidden;}
body{ height:100%; overflow:auto;}
#fixed{ position:absolute; top:100px; right:17px;}
</style>
<![endif]-->
</head>
<body>
<div id="wrapper">
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
</div>
<div id="fixed"><h2>{position:fixed}</h2></div>
</body>
</html>
红色部分为针对ie6模拟滚动条。