CSS Hack Daquan-teach you how to distinguish between IE6-IE10, FireFox, Chrome, Opera, ie6-ie10chrome

Source: Internet
Author: User

CSS Hack Daquan-teach you how to distinguish between IE6-IE10, FireFox, Chrome, Opera, ie6-ie10chrome

Today, I sorted out some common CSS Hack, including the commonly used IE hack and the Hack of Firefox, Chrome, and operabrowser, and integrated these CSS Hack together, I wrote a small browser tester.

 

The current browser IE6-IE10, Firefox, Chrome, Opera, Safari... There are a large number of competitors, and there are a lot of options for users, but this is a bitter problem for Web Front-end developers.
Today, I sorted out some common CSS Hack, including the commonly used IE hack and the Hack of Firefox, Chrome, and operabrowser, and integrated these CSS Hack together, I wrote a small browser tester. :

Let's take a look at the code below:

Html section:

 

The Code is as follows:
<Div class = "content">
<Div class = "test"> </div>
<Div class = "txt">
<P> background color in IE6: <span class = "ie6"> the Hack part of the code will not be pasted:

 

The Code is as follows:
. Content. test {
Width: 200px;
Height: 200px;
Background: # f60;/* all */
Background: #06f9;/* IE */
* Background: #666;/* IE6, 7 */
_ Background: # ccc;/* IE6 */
}

/* Webkit and opera */
@ Media all and (min-width: 0 ){
. Content. test {
Background: #0f0;
}
}

/* Webkit */
@ Media screen and (-webkit-min-device-pixel-ratio: 0 ){
. Content. test {
Background: # ff0;
}
}

/* FireFox */
@-Moz-document url-prefix (){
. Content. test {
Background: # f0f;
}
}

/* IE9 + */
@ Media all and (min-width: 0 ){
. Content. test {
Background: # f009;
}
}

/* IE10 + */
@ Media screen and (-ms-high-contrast: active), (-ms-high-contrast: none ){
. Content. test {
Background: # 0ff;
}
}

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.