CSS Hacks Google Chrome (works with FF 3.5)

Sep26
  • Share

Difficulty: ★★☆☆☆

Life is a bitch when you are a webdesigner. – With so much (new) browsers (Internet Explorer 6,7, Firefox 2,3, Opera 9, Chrome etc), your webdesign looks completely different in every browser, while browser compatibility is a very important point.
Luckily there are some hacks to exclude some browsers. In this post I target Google Chrome only:

These hacks don’t validate, but are 100% safe according to CSS parsing rules.

/* chrome browser */
body:nth-of-type(1) #hackme{ styles for chrome here }

Update Oct 2009: Since the release of Firefox 3.5 the above hack is not targeted by Chrome only anymore. Therefore use the following hack below:

@media screen and (-webkit-min-device-pixel-ratio:0){
	#hackme {  styles for chrome here }
}

7 Responses to “CSS Hacks Google Chrome (works with FF 3.5)”

Thanks for this. It should be noted that this hack works for Google Chrome 2.x whereas a different hack that worked for Chrome 1.x didn’t work with 2.x

Scott on June 1st, 2009 at 3:07 AM

Thanks! It works very well.

Pradeep on September 23rd, 2009 at 7:43 AM

Please note, this css hack, won’t differnentiates with the newest FF 3.5.
A new Chrome only hack should be used.

Lee on October 22nd, 2009 at 4:57 PM

Thanks, it works

krish on April 23rd, 2010 at 6:56 AM

This hack won’t affect only Chrome but also Safari!

Goerni on November 30th, 2010 at 12:39 PM

ohhhhhhh thanks u so much.
it’s work.

Ang on January 25th, 2011 at 10:39 AM

You rock! Thanks!

Daniel Kedinger on March 24th, 2011 at 4:36 PM

Leave a comment