博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

ie6的fixed解决

Posted on 2009-11-17 00:01  mr.qu  阅读(196)  评论(0)    收藏  举报

ie7,firefox都可以支持postion:fixed (随页面滚动),只是对ie6不起作用,其实解决的方法比较简单,在css里定义一个表达式就可以了。比如要把id为left_menu的元素fixed,就可以这样:


.left_menu{
position
:fixed; /*火狐*/
_position
:absolute; /*ie6*/
*position
:absolute; /*ie7,本来fixed已经可以了,但是加了top对ie7也会发生作用,所以只能和ie6一样定义*/
top
:expression(eval(document.documentElement.scrollTop)); }