Ie

Position Fixed Support In IE8

Posted by Weston Ganger on October 11, 2015

I was working on an application with Internet Explorer 8 and I added a element with position:fixed; and it was not appearing right at all.

Turns out IE8 doesnt implement the fixed position, ridiculous! So after a bit of googling I found a pretty good method, although its a wierd one.

This fix works in IE8 (maybe IE7 too).


.fixed-element{
  position:fixed;
  _position:absolute;
  
  /* if you want top */
  top:0;
  _top:expression(eval(document.body.scrollTop));

  /* if you want bottom */
  bottom:0;
  _top:expression(document.body.scrollTop+document.body.clientHeight-this.clientHeight);
}

Those underscores are something interesting and I dont know how they work but they do. Anyways this one has javascript in it so be sure to place the rule in the head of your layout with an IE conditional, not in an external stylesheet.


Related External Links:


Posted in HTML / CSS and Tagged with css internet-explorer 


Need help on your next project or application?

I specialize in Ruby-on-Rails, AngularJS, Javascript, Bootstrap, and Hybrid Mobile Apps with Cordova & Ionic.

Contact Me

Recommended Posts