Home >Web Front-end >CSS Tutorial >How Can I Apply CSS Rules Exclusively to a Div in Google Chrome?
Applying CSS Rules to Chrome-Exclusive Elements
To apply specific CSS rules to a designated div solely in Google Chrome, consider the following strategies:
CSS Solutions (Source: jeffclayton.wordpress.com/2015/08/10/1279/)
Chrome, Safari, Microsoft Edge, and Firefox:
@media screen and (-webkit-min-device-pixel-ratio:0) { div{top:10;} }
Chrome 29 :
@media screen and (-webkit-min-device-pixel-ratio:0) and (min-resolution:.001dpcm) { div{top:0;} }
Chrome 22-28:
@media screen and(-webkit-min-device-pixel-ratio:0) { .selector {-chrome-:only(; property:value; );} }
JavaScript Solution
Alternatively, you can use JavaScript to modify the div:
if (navigator.appVersion.indexOf("Chrome/") != -1) { // modify button }
The above is the detailed content of How Can I Apply CSS Rules Exclusively to a Div in Google Chrome?. For more information, please follow other related articles on the PHP Chinese website!