
On 10/31/2012 11:13 AM, Robert Gibbins wrote:
On Oct 8th Lee Passey wrote:
4. Book titles should be marked with the <h1> element, "part" titles should be marked with the <h2> element, chapter titles should be marked with the <h3> element, "section" titles should be marked with the <h4> element, and "sub-section" titles should be marked with the <h5> element. If a title is composed of both a main title and a subtitle, the subtitle should be distinguished from the main title by adding "class='subtitle'" as an attribute of the title element. Author's names in book titles should be indicated by <h1 class="author">.
My question is whether writing, for example:
<h3>CHAPTER 12</h3> <h3 class="subtitle">"WOULD YOU?"</h3>
as I think Lee is suggesting above, has any advantages (or disadvantages) over what I currently do which is:
<h3>CHAPTER 12</h3> <div class="chapter-title">"WOULD YOU?"</div>
(N.B. I had in any case been thinking of changing what I currently do to:
<h3>CHAPTER 12</h3> <div class="h3-title">"WOULD YOU?"</div>
largely on the grounds that it seemed more general not to bind by suggestive naming that <h3> be used only for chapters, (although Lee seems to want to do this anyway).
As implementing this change entails quite a lot of work, I would appreciate hearing any thoughts anyone has on this possibly rather trivial question.
The CSS specification cautions: <blockquote> CSS gives so much power to the "class" attribute, that authors could conceivably design their own "document language" based on elements with almost no associated presentation (such as DIV and SPAN in HTML) and assigning style information through the "class" attribute. Authors should avoid this practice since the structural elements of a document language often have recognized and accepted meanings and author-defined classes may not. </blockquote> For this reason, among others, I advocate (and practice) never using <div> or <span> for any element for which a reasonable alternative exists. <div> should be a last resort. The DP recommendation, with which I agree, is that e-books should be marked up using CSS in such a way that if style sheets are not supported (as some older e-book software) the presentation of the e-book is still reasonable (even if not optimal). In your current practice, if the user agent did not support style sheets your chapter subtitle would be presentationally indistinguishable from a paragraph. Given my suggestion, it would be presentationally indistinguishable from the main title, which is, I think, a better result. It is also more consistent with the "recognized and accepted meaning" of HTML markup. My proposed rule you quoted above is actually a simplification of what I actually do. My typical practice is to mark a chapter title as: <h3 class="chapter">CHAPTER 12</h3> and to mark a chapter subtitle as: <h3 class="chapter subtitle">"WOULD YOU?"</h3> Parts might be marked as: <h2 class="part">Première Partie</h2> <h2 class="part subtitle">Fantine</h2> If you are diligent about always marking a heading with "class='chapter'" it probably doesn't make a lot of difference which <h?> element you use for chapter titles, but I like the consistency of always knowing which element to use, and to get a consistent look and feel across books, especially when a user agent has an imperfect implementation of style sheets (and they all do). Frankly, I don't particularly object to Marcello's suggestion of <h3 class="chapter">CHAPTER 12<br /><span class="subtitle">"WOULD YOU?"</span></h3> either. It requires a little more understanding of the subtleties of HTML, but it has other advantages. If that were the consensus "best practice" I'd be happy with that.