Fixed Positioning in IE 6

* { margin:0; padding:0; }
html, body {
   height: 100%;
}
body #fixedElement {
   position:fixed !important;
   position: absolute; /*ie6 and above*/
   top: 0;
   right: 0;
}
#page-wrap {
    width: 600px;
    margin: 0 auto; 
    font: 16px/2 Georgia, Serif;
}

The 100% height on the body and html stuff is in case you want to do fixed positioning along the bottom edge of the browser window.

Reference URL

Comments

  1. User Avatar
    Hitesh Chavda
    Permalink to comment#

    Look like doe’t work on IE6

  2. User Avatar
    FJ
    Permalink to comment#

    or you do it over expressions.. like this:

    * html #element{
    		position: absolute; left: 0px; top: 0px;
    		left: expression( ( 0 + ( ignoreMe2 = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ) ) + 'px' );
    		top: expression( ( 0 + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ) ) + 'px' );		
    }

    this is for position fixet on TOP

    • User Avatar
      Mathiyalagan
      Permalink to comment#

      this code working for me. thanks dude. IE 6 problem finished.

  3. User Avatar
    Tony
    Permalink to comment#

    This tutorial saved my life. I didn’t think this was possible in IE6. Thank you, thank you, thank you.

  4. User Avatar
    amtyera
    Permalink to comment#

    Sorry. Not working in IE6

  5. User Avatar
    Shaz3e

    Not working for me too

  6. User Avatar
    cooljaz124
    Permalink to comment#

    It seems not working. Also, Is there any way to achieve the position:fixed effect for a div which have to be kept some distance from bottom , and not from top.

    Even, a jQuery solution will do. Thanks in advance.

  7. User Avatar
    Thierry Koblentz
    Permalink to comment#

    As FJ mentioned (10/25/2009) it is possible to do it with CSS expression, but with some extra hack to get a smooth scrolling:

    http://www.css-101.org/fixed-positioning/05.php

  8. User Avatar
    Kush
    Permalink to comment#

    You can use _position:absolute; along with position:fixed so that only ie will process that absolute part and rest of the browsers won’t even read it.

  9. User Avatar
    calistera
    Permalink to comment#

    OMGosh thanks! UR a wizard! xD =)

Posting Code

You may write comments in Markdown. This makes code easy to post, as you can write inline code like `<div>this</div>` or multiline blocks of code in triple backtick fences (```) with double new lines before and after.

Code of Conduct

Absolutely anyone is welcome to submit a comment here. But not all comments will be posted. Think of it like writing a letter to the editor. All submitted comments will be read, but not all published. Published comments will be on-topic, helpful, and further the discussion or debate.

Want to tell us something privately?

Feel free to use our contact form. That's a great place to let us know about typos or anything off-topic.

Submit a Comment

icon-closeicon-emailicon-linkicon-menuicon-searchicon-tag