Time for some CSS debate

That’s the best pun I could think of, pretty lame to be hon­est. My first foray into shared exper­i­mental CSS (pro­pri­et­ary Web­Kit prop­er­ties used to cre­ate a clock anim­a­tion) has fired up an inter­est­ing debate; where should the realm of cas­caded style sheets end?

This clock exper­i­ment does not advoc­ate such use of style sheets, it is instead used to demon­strate the cap­ab­il­it­ies and pos­sib­il­it­ies of WebKit’s trans­form and trans­ition prop­er­ties. It has inad­vert­ently high­lighted the con­tro­ver­sial and unex­pec­ted nature by which web developers may use them. Should this cross-pollination of beha­viour defin­i­tion become stand­ard? Is it risky? What might the side effects be?

Com­ments on the Ajaxian post began the dis­cus­sion, Malic opened the debate (this com­ment is par­tic­u­larly in ref­er­ence to ‘trans­ition’ rather than the more widely accep­ted ‘transform’):

While this [is] inter­est­ing and maybe a little bit cool, I think it is inap­pro­pri­ate for Web­kit to take CSS (even if only for itself) in this dir­ec­tion. CSS was cre­ated to define style. This seems more like a beha­vior to me and that belongs to the Javas­cript prob­lem space. Going down the the road that Web­kit is going, the ques­tion is — where do you stop? Just how much do you extend CSS to be? I think you run the risk of cre­at­ing solu­tions for prob­lems that have already been solved.

This yiel­ded some oppos­i­tion but the major­ity sup­por­ted the notion, Travis Almand cham­pi­ons the new trans­form prop­erty but strongly ques­tions its counter-part:

CSS should be a style guide, not a pro­gram­ming language.

Before high­light­ing that the road to beha­viour in CSS has already begun with the much used :hover, accom­pan­ied by :act­ive, and :focus — user action pseudo-classes, agents some­times change the ren­der­ing in response to user actions; response being the keyword.

Will Peavy com­ments that these beha­viours wreak reek of IE’s aban­doned CSS expres­sions, and edthered asks:

What hap­pens when your CSS lib­rary and your javas­cript lib­rary start try­ing to do the same thing to the same ele­ment, or dif­fer­ent things to the same element?

John Dowdell of Adobe has also weighed in with an hon­est rant that I heart­ily recom­mend read­ing, even if I’m slightly jeal­ous that I can­not artic­u­late my prose as well.

The clock example shows that people will use tech­no­lo­gies in unex­pec­ted ways. The cre­at­ors of Usenet did not intend mass advert­ising. […] Stuff­ing the genie back inside the bottle is harder than look­ing care­fully at the bottle before open­ing it.
[…]
We may not be able to per­suas­ively artic­u­late why this will even­tu­ally be con­sidered a bad archi­tec­tural decision. It’s like when vendors of email cli­ents star­ted talk­ing about how won­der­ful it would be to add hid­den graph­ics and script­ing to the emails strangers send to you. Vague warn­ings of an unsound future are at a dis­ad­vant­age to self-interested “But I wanna do it!!” evangelists.

It’s hard to per­suas­ively doc­u­ment future risks. But encum­ber­ing HTML and CSS like this is not the way to bless your own mul­ti­me­dia engine.

5 Comments

  1. Posted March 30, 2009 at 8:53 am | Permalink

    Sorry, just some spelling: ‘wreak’ should be ‘reek’.

  2. Posted May 8, 2009 at 11:37 am | Permalink

    nice debate. IMHO CSS is meant to style the page. With some basic effects like :hover CSS is a light/clean help but it should not extend to major hand­ling of elements.

  3. Rodney Reid
    Posted May 8, 2009 at 11:35 pm | Permalink

    I think CSS anim­a­tions are a nat­ural exten­sion of styling.

    How should you express anim­a­tions in a formal way?

    With JavaS­cript? It’s been done for well over a dec­ade. A thou­sand ways, and no end in sight.

    The concept of code­less anim­a­tion on the web isn’t new.

    SMIL2 (HTML+TIME) in IE 5.5+ (sum­mer 1999) was a good start, but the more I used it back when it came out, the more I wanted to just style some ele­ment anim­a­tion without copy­ing a dozen attrib­utes every time.

    Which looks more natural?

    .clickme {background-color: #000; }
    .clickme:hover { trans­ition: background-color 1s lin­ear #00f; }

    Click here

    or

    Click here

    $(‘.clickme’).style.backgroundColor.animate(“#000″, “#0F0”, “hover”, 0100);

    (apo­lo­gies for the pidgin jQuery and css anim — it would look some­thing like that though)

    One more thing — if tied to JS, you can­not guar­an­tee when an anim­a­tion starts/stops, how it’s sup­posed to degrade when there’s 1000 anim­ated ele­ments. Stop­ping on a JS error some­where else, etc.

    We already have the mess of that!

  4. Rodney Reid
    Posted May 8, 2009 at 11:36 pm | Permalink

    The form ate the greater/less thans, but I hope I got my point across!

  5. Posted February 9, 2010 at 7:30 pm | Permalink

    That’s good!

Post a Comment

Your email is never shared. Required fields are marked *

*
*