css--browser compatibility processing (PC)

Source: Internet
Author: User

To resolve the compatibility of Web pages in IE7: *

such as:. content{height:30px;    / * Normal Display effect * / *height:20px; /*ie7 Display effect * / }

To resolve the compatibility of Web pages in IE8:

Make a judgment on the head of the Web page.

<! DOCTYPE html>
<!--[if IE 8]> <![ Endif]-->
<!--[if! IE 8]>

<!--<! [endif]-->

If it is under IE8 browser, use the class name prefixed with the. IE8 style.

such as:. content{height:30px;} / * Styles displayed in other browsers * /

   . IE8 . content{height:20px;} the style shown in/*IE8 * /

To fix the compatibility of Web pages in Firefox:

@-moz-document Url-prefix () {/ * write the necessary style here * /}

Note: This is a way to solve all the incompatibilities of Firefox browsers.

To resolve the compatibility of Web pages in IE9:

\9\0(only used in IE9, other browsers do not recognize)

To resolve the compatibility of Web pages in IE10:

@media screen and (-ms-high-contrast:active), (-ms-high-contrast: none) {

. hacktest { background-color:Green;} /* For ie10+ This notation can be adapted to high contrast and default mode, thus covering all ie10 modes */

}

Selector Prefix method

The selector prefix method is for browsers that are inconsistent with some pages or that require special treatment, hack with prefixes that are only recognized by certain browsers before the CSS selector.

At present, the most common is

*html *Prefix only valid for IE6*+html *+Prefix only valid for IE7@media screen\9{...}only toIE6/7Effect@media \0screen {body {background:red;}}only toIE8Effective@media \0screen\,screen\9{body {background:blue;}}only toIE6/7/8Effective@media screen\0 {body {background:green;}}only toIE8/9/10Effective@media screen and (min-width:0\0) {body {background:gray;}}only toIE9/10Effective@media screen and (-ms-high-contrast:active), (-ms-high-contrast:none) {body {background:orange;}}only toIE10Effective, etc.

css--browser compatibility processing (PC)

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.