CSS: Filtering and Distinguishing Google Chrome and Safari

CSS: Filtering and Distinguishing Google Chrome and Safari

Personally, I avoid using CSS hacks, and when writing client code I always assume that anything can be done the “legal” way.

However, in most cases a hack is useful and needed, so here are two hacks (which are, in fact a valid CSS) that can be used to target and distinguish Google Chrome and Safari:

/* Google Chrome hack */
body:nth-of-type(1) .elementOrClassName
{
/* properties go here */
}

/* Safari hack */
body:first-of-type .elementOrClassName
{
/* properties go here */
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s