Css compatibility with various browsers

Source: Internet
Author: User

IE6 double margin
When viewing in IE6, you will find that the left margin is 100 pixels, Which is expanded to 200 pixels, and the display: inline can be used;
. Floatbox {
Float: left;
Width: 150px;
Height: 150px;
Margin: 5px 0 5px 100px;
Display: inline;
}

Solution IE6 does not support position: fixed; Attribute

General position: fixed; Implementation Method
For example, the CSS code used by the <div id = "top">... </div> HTML element in the lower right corner is as follows:
# Top {
Position: fixed;
Bottom: 0;
Right: 10px;
}
To fix the <div id = "top">... </div> element at the bottom of the browser and 10 pixels to the right.

How to Implement position: fixed; in IE6
# Top {
Position: fixed;
_ Position: absolute;
Bottom: 0;
Right: 10px;
_ Bottom: auto;
_ Top: extends umentElement. clientHeight-this.offsetHeight-(parseInt (this. currentStyle. marginTop, 10) | 0)-(parseInt (this. currentStyle. marginBottom, 10) | 0 ))
);
The _ symbol in _ position: absolute; can only be identified by IE6 to distinguish other browsers.

Pin the element to the top of the browser:
# Top {
_ Position: absolute;
_ Bottom: auto;
_ Top: expression(eval(document.doc umentElement. scrollTop ));
}

Fix the element at the bottom of the browser:
# Top {
_ Position: absolute;
_ Bottom: auto;
_ Top: expression(eval(document.documentElement.scrollTop+document.doc umentElement. clientHeight-this.offsetHeight-(parseInt (this. currentStyle. marginTop, 10) | 0)-(parseInt (this. currentStyle. marginBottom, 10) | 0 )));
}
The two pieces of code can only be implemented at the bottom and the top. You can use _ margin-top: 10px; or _ margin-bottom: 10px; to modify the position of the numerical control element.

Position: fixed; flashing

After using the above method, we 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:
* Html {
Background-image: url (about: blank );
Background-attachment: fixed;
}
* Is identified for IE6.

Solve ie compatibility with js

Make IE5 and IE6 compatible to IE7 mode (recommended)
<! -- [If lt IE 7]>
<Script src = "http://ie7-js.googlecode.com/svn/version/2.0 (beta)/IE7.js" type = "text/javascript"> </script>
<! [Endif] -->

Make IE5, IE6, and IE7 compatible with IE8 Mode
<! -- [If lt IE 8]>
<Script src = "http://ie7-js.googlecode.com/svn/version/2.0 (beta)/IE8.js" type = "text/javascript"> </script>
<! [Endif] -->

Make IE5, IE6, IE7, and IE8 compatible to IE9 Mode
<! -- [If lt IE 9]>
<Script src = "http://ie7-js.googlecode.com/svn/version/2.1 (beta4)/IE9.js"> </script>
<! [Endif] -->

Downgrade the IE version to 7.0
<Meta http-equiv = "X-UA-ompatible" content = "IE = EmulateIE7"/>
In addition;
<Meta http-equiv = "X-UA-Compatible" content = "IE = 7"/>

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.