[whatwg] Cascading Attribute Sheets

Thomas Broyer t.broyer at gmail.com
Sat Nov 1 12:34:19 PDT 2008


On Sat, Nov 1, 2008 at 6:11 PM, Pentasis wrote:
> In the "add type to mark element" discussion which I started, a side
> argument about ids and classes was brought up.
> I conveyed my opinion that I think classes should only be used as style
> handles and not to convey extra semantic meaning.
> The HTML4 spec states:
>
> "The class attribute has several roles in HTML:
>
>   * As a style sheet selector (when an author wishes to assign style
> information to a set of elements).
>   * For general purpose processing by user agents."
>
> The first role is clear, it is used for styles (not semantics)

Ian answered to this. You'll similarly or identically style elements
with similar or identical meaning; in other words, you'll attach style
to semantics, so your class names are likely to markup your document
with additional semantics.

> the second is
> a bit more muddy I think, but the important part there is: "processing BY
> user agents". User agents have no interest in semantics, so I fail to see
> here also why classes may be used to define semantic roles.

Microformats.

> The fact that a class should be named "footnote" for example is only so you
> will not get in trouble (unlike when you use a name like "red" or "left").
> But this only tells me (the author) that this element should be styled like
> a footnote and for the user agent that it should render it like a footnote.
> It should not tell me (or anything else) that it IS a footnote. This would
> lead inevitably to inflexibility.

Why not enclose your footnotes in <aside> elements?

Moreover, a note is not necessarily presented as a "footnote" (i.e.
moved to the end of the "page"), it can be shown in the margin (as in
the WHATWG version of the HTML5 spec) or in popup panels when you
click on a word or "footnote reference" (similarly to definitions in
the old HTMLHelp on Windows).

-- 
Thomas Broyer



More information about the whatwg mailing list