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)
CSS Hack for Firefox:
@-Moz-document url-prefix () {. selector {attribute: value ;}}
CSS Hack for webkit kernel and operabrowser:
@ Media all and (min-width: 0) {. selector {attribute: value;/* for webkit and opera */}}
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 */}}
- 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.
- 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.