Re: XHTML 2.0 considered harmful

Mikko wrote on Wednesday, January 15, 2003 at 9:06:49 AM:

> I agree. It seems that those who prefer br over l are the same ones
> that want to keep the style attribute.

If you check the archive of www-html and www-style, you'll see that I
favor l over br but want to keep the style attribute.

id and class attribute values have no semantic meaning as defined by
HTML. Using id="bonus" has no semantic meaning. Assuming id isn't
being used for anything else (and it may be, but in this case I'm
saying it specifically isn't), a style needs to be attached through a
style sheet or that attribute has no purpose. Thus, the id attribute
(for style) does nothing if style sheets are off, if the UA doesn't
understand style sheets, or if the document is being read without a
style sheet. Make no mistake, the difference between the style
attribute and attaching style via the id attribute is only a
difference in method. The id attribute adds *no semantic value*. Any
information being added is purely presentational.

Thus, the style attribute is no more harmful than (most uses of) the
id attribute. The difference is only in method. If an id attribute's
style is defined in a linked or imported style sheet, it may be lost
and the document may be read without it. If the id attribute's style
is embedded in the document via the style element (sic), this problem
doesn't exist. However, the difference between an id attribute's style
being in the style element and being directly in the style attribute
is *purely* a difference of method.

In this case, it's easier for the author to use the style attribute
than it is to use the style element, the information embedded is
shorter (since there is no selector required), and the document isn't
polluted with id attributes being used solely for styling. (You can
strip all the style attributes out of a document, but you can't strip
out all the id attributes that are *only* being used for styling.)
There is only one disadvantage I know of (that the user can't read the
document's ids to create a user style sheet styling them--but this is
a problem for advanced users only). Check the archive of www-style and
www-html for examples from other people.

I do think styling id attributes is a more important capability of
CSS, and I do think it will be used more often. That doesn't mean I
don't see the value of the style attribute's ease of use (since I use
it all the time myself), and it doesn't mean I ignore the differences
between styling id/class attributes and using the style attribute.
Which, to be frank, is what I've seen a lot of on this list.

-- 
John

Received on Wednesday, 15 January 2003 19:42:57 UTC