Have never run across an instance where I had to do a Chrome-only css hack until now. However, I found this to move content below a slideshow where clear:both; affected nothing in Chrome (but worked fine everywhere else - even IE!).
@media screen and (-webkit-min-device-pixel-ratio:0) {
/* Safari and Chrome, if Chrome rule needed */
.container {
margin-top:100px;
}
/* Safari 5+ ONLY */
::i-block-chrome, .container {
margin-top:0px;
}
This css browser selector may help you. Take a look.
CSS Browser Selector is a very small javascript with just one line
which empower CSS selectors. It gives you the ability to write
specific CSS code for each operating system and each browser.
As we know,Chrome is a Webkit browser,Safari is a Webkit browser too,and Also Opera,so it's very hard to target the Google Chrome,using media queries or CSS hacks,but Javascript is really more effective.
Here is the piece of Javascript code that will target Google Chrome 14 and later,
var isChrome = !!window.chrome && !!window.chrome.webstore;
and below is a list of Available Browser hacks,for the Google chrome including the influenced browser,by that hack
WebKit hack:
.selector:not(*:root) {}
Google Chrome:All the versions
Safari:All the versions
Opera :14 and Later
Android:All the versions
Supports Hacks:
@supports (-webkit-appearance:none) {}
Google Chrome 28,and Google Chrome > 28, Opera 14 and Opera > 14
Google Chrome 28,and Google Chrome < 28, Opera 14 and Opera > 14,and Safari 7 and Less than 7.
- Google Chrome:28 and Before
- Safari:7 and Before
- Opera :14 and Later
JavaScript Hacks:1
var isChromium = !!window.chrome;
Google Chrome:All the versions
Opera :14 and Later
Android:4.0.4
JavaScript Hacks:2 {Webkit}
var isWebkit = 'WebkitAppearance' in document.documentElement.style;
Google Chrome:All the versions
Safari:3 and Later
Opera :14 and Later
JavaScript Hacks:3
var isChrome = !!window.chrome && !!window.chrome.webstore;
Google Chrome:14 and Later
Media Query Hacks:1
@media \\0 screen {}
Google Chrome:22 to 28
Safari:7 and Later
Media Query Hacks:2
@media all and (-webkit-min-device-pixel-ratio:0) and (min-resolution: .001dpcm) { .selector {} }
Have never run across an instance where I had to do a Chrome-only css hack until now. However, I found this to move content below a slideshow where clear:both; affected nothing in Chrome (but worked fine everywhere else - even IE!).
if you want we can add class to specific brwoser see [fiddle link][1] [1]:
This css browser selector may help you. Take a look.
As we know,Chrome is a Webkit browser,Safari is a Webkit browser too,and Also Opera,so it's very hard to target the Google Chrome,using media queries or CSS hacks,but Javascript is really more effective.
Here is the piece of Javascript code that will target Google Chrome 14 and later,
and below is a list of Available Browser hacks,for the Google chrome including the influenced browser,by that hack
WebKit hack:
Supports Hacks:
Google Chrome 28,and Google Chrome > 28, Opera 14 and Opera > 14
Property/Value Hacks:
Google Chrome 28,and Google Chrome < 28, Opera 14 and Opera > 14,and Safari 7 and Less than 7. - Google Chrome:28 and Before - Safari:7 and Before - Opera :14 and Later
JavaScript Hacks:1
JavaScript Hacks:2 {Webkit}
JavaScript Hacks:3
Media Query Hacks:1
Media Query Hacks:2
For more information please visit this website
I am using a sass mixin for chrome styles, this is for
Chrome 29+
borrowing the solution from Martin Kristiansson above.Use it like this: