Webkit CSS-hack deprecated?

I use @media screen (-webkit-min-device-pixel-ratio:0) hack to specifically view Webkit browsers.

But it doesn't seem to work, does anyone know this hack?

Are there other ways to target Webkit browsers?

Update: Not outdated, I forgot to put "and" after the "screen".

+6
source share
2 answers

The following example will display the #box color background in Chrome and Safari, but not Firefox and Opera.

 <!DOCTYPE html> <html> <head> <style type="text/css"> @media screen and (-webkit-min-device-pixel-ratio:0) { #box { background: #f0f; } } </style> </head> <body> <div id="box"> I'll have a background in Webkit browsers. </div> </body> </html> 

If that’s not enough, you can take a look at this article about browser-specific CSS hacks on Webmonkey . It includes works for both Internet Explorer, Firefox, Safari, and Opera, as well as for the example above.

+11
source

Try this CSS Webkit hack:

 @media all and (-webkit-min-device-pixel-ratio:0) { #box { background: #f0f; } 
+3
source

Source: https://habr.com/ru/post/901627/


All Articles