As body:nth-of-type(1) and body:first-of-type are supported by FireFox 3.5x, the hack that I wrote about in this post cannot be used anymore. You may try the following one, which targets only 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 */
}
[...] avoid using) some more complex, and frankly scary, than others. The following application came from Martin Ivanov’s blog, dated Oct 1, 2008: /* Google Chrome hack */ body:nth-of-type(1) .elementOrClassName { /* [...]
[...] si nuestro usuario está usando Google Chrome o Safari es dificil desde nuestro CSS, pero no imposible. Ahora con este hack podemos distinguir que navegador está usando nuestro usuario pese a que los [...]
[...] Limitation of Internet Explorer and More 04. Unobtrusive CSS Loading Indicator for Images 05. CSS: Filtering and Distinguishing Google Chrome and Safari 06. Controlling the CSS Opacity Rate of Child Elements in Transparent Parents in Internet Explorer [...]
[...] and body:first-of-type are supported by FireFox 3.5x, the hack that I wrote about in this post cannot be used anymore. You may try the following one, which targets only Google Chrome and [...]