CSS fixed container in IE6

#fixed {
    border:1px solid red;
    height:100px;
    left:50%;
    margin-left:-500px;
    position:fixed;
    top:0;
    width:1000px;
}

      

how can i make this element the same in IE6? div is the first element directly in the body is considered

+2


a source to share


3 answers


IE 6 does not support position: fixed

( Source ) and as far as I know there is no simple simplified CSS solution.

You will need to use a JavaScript-based workaround that adjusts the position of the element as the page scrolls.



Here's a very simple solution as described in this SO question . These JS based solutions tend to be pretty ridiculous and harsh in my experience, they are nowhere near smooth position: fixed

.

+2


a source


Sorry, didn't have time to translate my example with your exact requirements, but breathe in this code:



// Modern browser : FF, Chrome, Opera
// ----------------------------------------

#fixmetoo { position: absolute; right: 0px; bottom: 0px; }
div > div#fixmetoo { position: fixed; }


// IE6
-------------------------------------------

<!--[if lt IE 7]>
div#fixmetoo {
        right: auto; bottom: auto;
        left: expression( ( -80 - fixmetoo.offsetWidth + ( document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body.clientWidth ) + ( ignoreMe2 = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ) ) + 'px' );
        top: expression( ( -100 - fixmetoo.offsetHeight + ( document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight ) + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ) ) + 'px' );
    }
<![endif]-->

      

+1


a source


Hum, you can try this css - then the element is centered.

<!--[if lt IE 7]>
<style type="text/css">
#fixed {
margin: 0 auto; 
}
</style>
<![endif]-->

      

0


a source







All Articles