Css position fixed bottom (compatible with ie6)

Source: Internet
Author: User
Tags eval

General position: fixed; implementation method
Take my blog as an example. The CSS code used by the <div id = "top">... </div> HTML element in the lower right corner is as follows:

The code is as follows: Copy code
# Top {
Position: fixed;
Bottom: 0;
Right: 20px;
}

To fix the <div id = "top">... </div> element at the bottom of the browser and 20 pixels to the right.


How to implement position: fixed; in IE6
As mentioned earlier, position: fixed; cannot be used directly in IE6 ;. You need some CSS Hack to solve it. Of course, IE6 is not just about position: fixed;

Let <div id = "top">... </div> fix the elements at the bottom of the browser and 20 pixels to the right.


Later I found a piece of code, which is compatible with ie6 and fixed at the bottom.

The code is as follows: Copy code

* Body {

Background-attachment: fixed;
Background-image: url (about: blank);/* required, anti-jitter */
}
* Body # fixed {
Position: absolute;
Top: expression(eval(document.doc umentElement. scrollTop + 10);/* top fixed suspension */
/* Top: expression(eval(document.documentelement.scrolltop?document.doc umentElement. ClientHeight-this.offsetHeight-10);/* bottom fixed suspension */
}
# Fixed {
Border: 1px solid;
Position: fixed;
Right: 10px;
Top: 10px;
}


Flash Problems

The problem has not been completely solved yet. After using the above method, you will find that the fixed positioning elements will flash when rolling the scroll bar. To solve the flash problem, add the following content to the CSS file:

The code is as follows: Copy code
* Html {
Background-image: url (about: blank );
Background-attachment: fixed;
}

* Is identified for IE6.

At this point, the position: fixed; problem of IE6 has been resolved.

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.