I had suggested this very thing a short while back, and was pointed toward
the CLASS attribute. I felt uncomfortable with that, but was unable to put
my finger on exactly why; I can state it better now. The reason is for
consistency with the STYLE element in the HEAD. It makes no sense to use
CLASS unless you have CLASS in the HEAD.
I'm not saying STYLE should replace CLASS. I'm saying the attribute name
should match what it references. If you are using CLASS="myname", then you
should be defining CLASS names in the HEAD, not STYLE names.
To illustrate:
<HEAD>
<TITLE>The Consistent CLASS Approach</TITLE>
<CLASS MIME="application/css">
mainhead {align: center; color: #005C00}
H2 {font-family: Helvetica; font-size: 18; font-weight: bold}
subhead1 {based-on: H2; font-style: small-caps; color: #000066}
subhead2 {based-on: subhead1; font-style: italic; color: #660000}
</CLASS>
</HEAD>
<BODY>
<H1 CLASS="mainhead">Walter's Second Take at Style vs Class</H1>
<H2 CLASS="subhead1">This is in dark blue</H2>
<H2 CLASS="subhead2">This is in dark red, and italic</H2>
</BODY>
or...
<HEAD>
<TITLE>The Consistent STYLE Approach</TITLE>
<STYLE NOTATION="css">
mainhead {align: center; color: #005C00}
H2 {font-family: Helvetica; font-size: 18; font-weight: bold}
subhead1 {based-on: H2; font-style: small-caps; color: #000066}
subhead2 {based-on: subhead1; font-style: italic; color: #660000}
</STYLE>
</HEAD>
<BODY>
<H1 STYLE="mainhead">Walter's Second Take at Style vs Class</H1>
<H2 STYLE="subhead1">This is in dark blue</H2>
<H2 STYLE="subhead2">This is in dark red, and italic</H2>
</BODY>
With this, the attribute name is consistent and logical.
>This is fine but there have been objections from those who want nameless
>formatting changes all over the place.
>
>Actually, as a technical author, my experience editing the documents produced
>by colleagues is that in most cases replacing the on-the fly formatting
>with proper named styles resulted in better looking documents. Slapping a
>quick bold here and a font change there just ends up looking a mess.
And we already have <B>, <I>, <STRONG>, and <EM>; these are sufficient for
"direct" formatting occasions. Actually, style sheets render <B> and <I>
obsolete, so <STRONG> and <EM> remain. Anything more complex than that is
best defined as a style (class, whatever).
>Having a good set of per-document-type formatting names actually makes
>writing easier (I use the term document type in the sense that lecture
>notes and publicity flyers are different document types; not in the
>SGML sense).
I agree. I do all my web authoring by hand in a drag&drop text editor,
using stuff like <font size="+2"><B><I>xxx</I></B></font>. I would GLADLY
switch to something like <SPAN STYLE="subhead2">xxx</SPAN> with "subhead2"
previously defined, as it makes handwritten code infinitely easier to read
and maintain.
To summarize my feelings:
I am against <XXX STYLE="font: helvetica; size: 14">
I am for a <XXX STYLE="stylename">
I am for a <XXX CLASS="stylename">
I am against CLASS attribute referencing a STYLE element in head
I am for a CLASS attribute referencing a CLASS element in head
I am for a STYLE attribute referencing a STYLE element in head
And I hope I've stated it more clearly this time.
-Walter
__________________________________________________________________________
Walter Ian Kaye <[email protected]> | Excel | FoxPro | AppleScript |
Mountain View, CA |--------- programmer ---------|
http://www.natural-innovations.com/ | Macintosh | Windows |