Code Snippet

Home » Code Snippets » CSS » Fixed Positioning in IE 6

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

Subscribe to The Thread

  1. Hitesh Chavda

    Look like doe’t work on IE6

  2. 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

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

  4. Sorry. Not working in IE6

  5. Not working for me too

  6. 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. 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

Speak, my friend

At this moment, you have an awesome opportunity* to be the person your mother always wanted you to be: kind, helpful, and smart. Do that, and we'll give you a big ol' gold star for the day (literally).

Posting tips:
  • You can use basic HTML
  • When posting code, please turn all
    < characters into &lt;
  • If the code is multi-line, use
    <pre><code></code></pre>
Thank you,
~ The Management ~