Re: About dropping the style attribute

> I've realized now that the current spec drops the style attribute for
> all elements except for the <font>, but I can't understand the
> reasoning behind those decisions.

And neither do I, and according to my experience as well as the discussion on that subject there are several cases why we need to keep the "style" attribute.


* To allow authors to set really varying formatting:

  This is probably not the best description for that argument, so let's use an example: There is partially strong desire to avoid page load "flickering" caused by images being loaded. The usual way to address that is by setting "width" and "height" attributes which should be replaced by the "style" attribute (that is presentational by design).

  <img src="foo" style="width: 100px; height: 200px;">

  Assuming that we don't talk about galleries where all thumbs have the same size (and may thus be styled via "#gallery img {}", for example), but instead a content rich website that uses many different image or media sizes, there is no other practical option but using "style" for defining each measurement. (Even though we'd probably specify no image measurements at all.)


* To enable/ensure styling of external material:

  Another suboptimal description, yet again garnished with an example - take advertising agencies that deliver ad code to commercial websites. Apart from the shadow world their markup appears to come from, we want them to adhere to web standards, too [1].

  But how's that going to happen without "style"? Considering a really simple banner ad where the ad company only wants to make sure there appears no border around the banner, there are basically three options:

  1. Hope for each partner to remove an eventual border. (Doesn't work.)
  2. Delivering the ad with 'border="0"' (or worse). (Presentational.)
  3. Delivering the ad with 'style="border: 0;"'. (More kids in town.)


* To enable (probable) scoped style sheets:

  Robert Burns already mentioned them [2], and even though I remember Eric (Meyer) to be unsure about their future, scoped style sheets [3] might become a really great thing one day.

  Arguments for scoped style sheets should probably be collected on <www-style>, but in theory they could mean even more elegant and effective style sheets [...].


Presumably we could go on with compatibility, philosophy, and other arguments ... Consequently, I consider it not necessarily wise to drop the "style" attribute. It's probably the wrong signal, and we should instead focus on advocating its appropriate use.


Regards,
 Jens.


[1] http://meiert.com/en/blog/20070107/evangelists-focus-on-standard-ad-code/
[2] http://lists.w3.org/Archives/Public/public-html/2007Jun/0659.html
[3] http://www.w3.org/TR/css-style-attr#examples

-- 
Jens Meiert
http://meiert.com/en/

Received on Tuesday, 26 June 2007 10:04:13 UTC