W3C home > Mailing lists > Public > www-style@w3.org > March 2011

Re: [css3] [css21] browser specific CSS

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Thu, 31 Mar 2011 16:24:39 -0700
Message-ID: <AANLkTi=m6dFDubrjZPvnU9XyfgbVDXp62=u_kYHR8fd-@mail.gmail.com>
To: Glenn Linderman <v+html@g.nevcal.com>
Cc: www-style@w3.org
On Fri, Mar 25, 2011 at 2:50 AM, Glenn Linderman <v+html@g.nevcal.com> wrote:
> So I've just downloaded the latest crop of browsers, IE Opera Chrome and Firefox.
> There are still a fair number of differences in the way they do things, and so there is still a need to tweak CSS to compensate.
> I dislike the "CSS hacks" and they are insufficient to isolate particular versions of particular browsers.
> http://rafael.adm.br/css_browser_selector  is a pretty cool technique which I have enhanced to solve some some issues where IE9 acts differently than the other browsers.  Sadly, it requires JavaScript to be enabled.
> While I understand that the goal of standards is to achieve universal conformance, that is a process that takes time and investment, which isn't uniformly applied across all browser suppliers. Hence, I propose that CSS should define a standard way of detecting a particular browser, by common name and version number (at least the first two level of version number).  A result that is at least as usable as rafael's technique, where a particular browser can be specified by name or by name and major version, or by name and major and minor version, and used as part of the selector for various CSS rules.
> While I would be delighted if all browsers actually did implement all CSS in the same standard-conforming way, omissions, bugs, and extensions all exist, and have for many years now, and likely will continue to exist.  Hence, a standard that doesn't support the differences by allowing the specific browser to be identified and conditional rules specified for it, is deficient.
> I realize that no existing browser, including this latest crop, implements such a standard, nor will the old versions ever be updated to have such a browser identification scheme.  We will be stuck with JavaScript and/or CSS hacks for many years.  But just as Microsoft is attempting to make IE6 die, perhaps eventually such a scheme would be widespread enough to be useful.  I rather expect that would happen long before all browsers are uniform in their CSS implementations.
> My revision of Rafael's scheme can be found at http://nevcal.com/cssrequest.js but I have no documentation other than a few added comments at the top of the code.

Browser-specific hacks are a strong anti-pattern that we shouldn't
propagate, or even worse, officially bless in CSS.  This does mean
that us web authors have a somewhat more difficult job, either
designing good CSS that still works in the presence of bugs, or making
our code ugly with hacks on occasion, but I think that's an acceptable

The one area where we *do* want to do something, imo, is in making CSS
capable of doing feature-testing.  This has been proposed in the group
before, via an @supports rule.  This doesn't let you work around
browser bugs (except insofar as you can abuse this to do browser
selection similar to how you can abuse vendor-specific selectors), but
it does let you work around less powerful older browsers that don't
understand some new functionality.

Received on Thursday, 31 March 2011 23:25:32 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:38:44 UTC