Is there a Google Chrome-only CSS hack? Many previously existing hacks that used to work for Chrome now are being picked up (used) by other browsers. I need one that targets Google Chrome, but not also other browsers like Mozilla Firefox, Safari, or Microsoft Edge.
CSS hacks are sometimes used to achieve consistent layout appearance in multiple browsers that do not have compatible rendering. Most of these hacks do not work in modern versions of the browsers, and other techniques, such as feature support detection, have become more prevalent.
Use of the new @supports at-rule or 'feature check' allows your browser to check if a specific CSS property or feature, and its value, is supported in the user's browser.
Sure is:
@media screen and (-webkit-min-device-pixel-ratio:0) { #element { properties:value; } }
And a little fiddle to see it in action - http://jsfiddle.net/Hey7J/
Must add tho... this is generally bad practice, you shouldn't really be at the point where you start to need individual browser hacks to make you CSS work. Try using reset style sheets at the start of your project, to help avoid this.
Also, these hacks may not be future proof.
Only Chrome CSS hack:
@media all and (-webkit-min-device-pixel-ratio:0) and (min-resolution: .001dpcm) { #selector { background: red; } }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With