PDA

View Full Version : CSS Hack for Google Chrome


Alexancho
19th September 10, 02:14 PM
I need a one div to be in Chrome only, so i used a code:
div.chrome_hack{
display:none;
}
@media screen and (-webkit-min-device-pixel-ratio:0)
{
div.chrome_hack{
display:block;
}
}
It works, but causes a validation error:
110 Property -webkit-min-device-pixel-ratio doesn't exist for media screen : 0 0

Is there a better solution?
And if there isn't can we say this solution is correct?

meesa
19th September 10, 02:27 PM
That's the best solution out there. Really, you're CSS is fine, it's just that the validator doesn't know that one small thing (Which is good, you only want Chrome [Safari gets it too] to see it.) so it calls it as an error.

Alexancho
19th September 10, 04:46 PM
Thank you very much!