Vendor specific extensions: The Good, the Bad and the Ugly

The Good:

The Good:

CSS3 is great fun! It can speed up our work process with simple syntax for creating awesome drop/text shadows, gradients, rounded corners, animations etc. It's a virtual wonderland for any web developer/designer for easily whip up visual elements that would normally take at least a few sprites, several hours of writing code and countless Advil when trying to get it all to work cross-browser. When a company wanted to experiment with the specification of a desired attribute, they would create an extension for the user base to 'beta' test it. This is great way to try things out.

With a simple declaration, we can have a drop shadow in no time:

<span style="font-size: medium;">box-shadow: 10px 10px 5px #888;</span>

Or a subtle gradient:

<span style="font-size: medium;">background: linear-gradient(black, white);</span>

We could call it a day if all the browsers met the desired specification from the W3C and implemented them accordingly. Unfortunately, this isn't the situation we currently live with and we're starting to see a growing trend that should be suppressed before it gets to out of control.

The bad:

Vendor specific extensions are the css hacks of today. We write out our style blocks in a way to cascade to style value that is relevant while still going down the line to the most standardized style. This is all the while going through an increasingly long list of vender specific extensions1. It certainly draws a close correlation to '* html', 'html>', or 'html>body' of only a few years ago, when we were trying to morph our code to be perfect for every browser. If you refer back to my previous post on progressive enhancement, we really should be pushing forward rather than coddling the dated and inefficient. Even with updates to the w3c validator to include css3, our style sheets still won't validate based on these extensions. With the correct amount of markup and careful consideration, no browser hack or browser extension should really be necessary.

  1. <span style="font-size: medium;">
  2. -webkit-border-radius: 20px;
  3. -webkit-border-top-right-radius: 5px;
  4. -webkit-border-bottom-left-radius: 5px;
  5. -moz-border-radius: 20px;
  6. -moz-border-radius-topright: 5px;
  7. -moz-border-radius-bottomleft: 5px;
  8. border-radius: 20px;
  9. border-top-right-radius: 5px;
  10. border-bottom-left-radius: 5px;
  11. </span>

…is reminiscent of this:1

  1. <span style="font-size: medium;">
  2. padding: 10px;
  3. width: 200px;
  4. width: 180px;
  5. height: 200px;
  6. height: 180px;
  7. </span>

..or

  1. <span style="font-size: medium;"><pre>[php]
  2. .classnameOrElement {
  3. color /***/: blue9
  4. }
  5. html>/**/body #id {
  6. property: value;
  7. }
  8. .ie8only {
  9. color /***/: #fff9
  10. }

[/php]

The Ugly:

This isn't even a full list of the extensions; we could include –o, -khtml, -ms and filter (depending on the desired effect you're looking for). Some of these browsers even go to the extent of supporting the same functionality but adding their own prefix to the effect. So in essence, we have some browsers supporting non-spec related functionality with their own prefix that all then do the same effect.

When will we just be able to write in 'border-radius:' or 'transition:' without declaring 5 other slightly similar lines of code to do the exact same things in another browser? It may be nit-picky to talk about supporting a few more lines of code to achieve a certain effect, but it's starting to feel like we are running away from web standards after we worked so hard to create standards from the overbearing rule of IE. If we work back towards standards, there is no reason to have an individualized browser extension. If it's good enough to be included in the w3c specification and gives your competition a run for their money, than a company shouldn't have to slap a browser specific extension on it.

  1. www.alistapart.com/articles/prefix-or-posthack/

Josh Cooper