有个限制,一定要设置一下DOCTYPE
给需要fixed的元素加个类名class='fixed'
普通的style里面
div.fixed {
position; fixed
}
给支持fixed的浏览器
然后加上
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
给需要fixed的元素加个类名class='fixed'
普通的style里面
div.fixed {
position; fixed
}
给支持fixed的浏览器
然后加上
<!--[if lte IE 6]>
<style type="text/css">
html, body
{
height: 100%;
overflow: auto;
}
div.fixed {
position: absolute;
}
</style>
<![endif]-->
本文介绍了一种兼容IE6的fixed定位方案。通过设置DOCTYPE并利用条件注释为IE6提供特定样式,确保了fixed定位在现代浏览器及IE6上的正确显示。
1485

被折叠的 条评论
为什么被折叠?



