To solve the problem that IE6 does not support position: fixed;, ie6fixed

Source: Internet
Author: User

To solve the problem that IE6 does not support position: fixed;, ie6fixed

In web page design, it is often used to always position an element on the screen, even if the browser window is rolled, it will not change.

Generally, we use position: fixed for absolute fixation, but IE6 does not support the position: fixed attribute. Therefore, we must take special care of IE6 ".

The following code is implemented: We want to locate the element in the HTML code at the bottom of the browser.
<div class="box"></div><div class="content"></div>
CSS code
. Box {background: # 69C; height: 60px; width: 500px; position: fixed; left: 0; bottom: 0 ;}. content {height: 5000px;/* Make the content long enough for you to conveniently view the scrolling effect */background: # 9CF ;}

Now it is normal in Firefox. Next we will add some targeted code for IE6 and add it to box.

_position:absolute;_bottom:auto;_top:expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight-this.offsetHeight-(parseInt(this.currentStyle.marginTop,10)||0)-(parseInt(this.currentStyle.marginBottom,10)||0)));

Now the fixed positioning effect has been achieved in IE6, but when moving the scroll bar, there will be a flash screen, so you also need to add in the box

* Html {background-image: url (about: blank); background-attachment: fixed ;}

Analysis

The left and right positions can be solved by absolute positioning. Therefore, the absolute positioning for IE6 is added.

_ Position: absolute; top and bottom must be implemented using the above expression.

To locate the box element at the top of the browser, you only need to modify the value of _ top. The Code is as follows:

_top:expression(eval(document.documentElement.scrollTop));

If you want the box element to be neither at the top nor at the bottom, you can use _ margin-top: 30px; or _ margin-bottom: 30px; modify the value to control the element position.

IE6 does not support position: fixed;. The problem has been completely solved. If you want to have a deeper understanding, please do it more!

Welcome to repost, but please keep the original address http://www.sjyhome.com/css/let-ie6-support-position-fixed.html


Incompatibility issues in IE6 after a DIV position is fixed with position: fixed

This should be a browser issue. Otherwise, why should I upgrade my browser.

Position: fixed in ie6

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.