Css hack in different browsers and csshack in browsers

Source: Internet
Author: User

Css hack in different browsers and csshack in browsers

Today, I took over a new project and will finish it by the end of the year. I wish you a smooth completion of your work. Some browser compatibility problems were encountered when setting up the CSS framework. So let's count the css hack for each browser.

(Pasted from encyclopedia)

  1. CSS Hack for Firefox:

    @-Moz-document url-prefix () {. selector {attribute: value ;}}

  2. CSS Hack for webkit kernel and operabrowser:

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

  3. From this style, we can only distinguish webkit kernel browsers from operabrowsers from other browsers, but they cannot be differentiated. Therefore, we also need to add a style based on the above style:

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

     

  4. Because this style is for webkit and will overwrite the previous style, you can use these two styles to differentiate webkit and opera. The attribute value of opera is set to value, the value of webkit is valueForWebKit.

     

  5. In fact, in general, we generally deal with compatibility issues on ie, but when we need to deal with compatibility issues on Firefox or Chrome, make sure to check whether the webpage structure is reasonable and whether the user guide is standardized until the CSS Hack is used as a last resort.

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.