CSS HACK in different browsers

Source: Internet
Author: User

I got a new project today and I have to finish it by the end. I wish I could finish the work smoothly. In the process of CSS framework, there are some browser compatibility issues encountered. So we will count the browser-specific CSS hack bar.

(Paste from Wikipedia)

  1. CSS Hack for Firefox:

    @-moz-document Url-prefix () {. selector {attribute:value; }}

  2. CSS Hack for WebKit kernel and Opera browser:

    @media all and (min-width:0) {. selector {attribute:value;/*for WebKit and opera*/}}

  3. From this style we can only distinguish the WebKit kernel browser and opera browser from other browsers, but we cannot distinguish between them, so we also need to add a style to the above style:

    @media screen and (-webkit-min-device-pixel-ratio:0) {. selector {attribute:valueforwebkit;/*only for webkit*/ }}

  4. Since this style is for WebKit, the previous style will be overwritten, so, through these two styles can distinguish between WebKit and opera, opera's attribute value takes Value,webkit attribute value to take valueforwebkit.

  5. In fact, as a general rule, we generally deal with the compatibility problem on IE, but when faced with the need to deal with Firefox or Chrome compatibility issues, be sure to check the structure of the Web page is reasonable and the use of notes is standard, until forced to use the above CSS Hack.

CSS HACK in different browsers

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.