Tuesday, March 18, 2008

Fixed position in IE

IE does not support position: fixed like Firefox does. But we still have way to make it possible.

/* set background url to whatever you want and then make it fixed position.*/
body{

background:url(foo1) fixed;
}

/* this is the div that you want to be fix */
#my_div{

position:fixed;
_position:absolute;
top:0;
_top:expression(eval(document.body.scrollTop));
left:0;
margin:0;
padding:0;
background:lime;
}

Actually, I got this stuff from http://annevankesteren.nl/test/examples/ie/position-fixed.html

Hope this help.

No comments: