tags:

views:

28

answers:

1

Hello, I'm writing a small book in HTML5 which is divided into chapters and sections like this:

chapter1.html - intro to chapter 1
    chapter1section1.html - section 1.1
    chapter1section2.html - section 1.2
chapter2.html - intro to chapter 2
    chapter2section1.html - section 2.1
    chapter2section2.html - section 2.2

As soon as I started writing sections I wondered about the best way to mark up my documents. I'm in doubt about the use of the <section> element in this particular case (maybe it's better to divide chapters into articles?).

I'm also hesitant about wrapping all content inside a <section>. I'm doing it so I can arrange them easily. I decided to do this after reading some comment in the HTML5 spec draft.

It's possible I end up putting the whole booke inside one file and it seems to me this structure would make this easier. What do you think?

Thanks in advanced!

chapter1.html:

<header>
    <nav>
        <ol>
            <li><a href="index.html">Start</a></li>
        </ol>
    </nav>
</header>
<section>
    <h1>This is chapter 1</h1>
    <p>Some content as introduction to chapter 1...</p>
</section>

chapter1section1.html

<header>
    <nav>
        <ol>
            <li><a href="chapter1.html">Up</a></li>
            <li><a href="index.html">Start</a></li>
        </ol>
    </nav>
</header>
<section>
    <h1>This is section 1.1</h1>
    <p>Some introductory content to section 1.1...</p>

    <section>
        <h1>This is subsection 1.1.1</h1>
        <p>Some content...</p>
    </section>
</section>
+1  A: 

It seems well-structured... but I would do a couple of things differently.

I think that the first-level sections might be omitted... after all they're just wrappers for the whole page's content, so their heading (the h1 "This is chapter 1" and "This is section 1.1") can refer to the page itself. Unless, as you say, you're considering putting the whole book in one document (in that case I'd keep the sections and there should be another h1 outside, with the title of the book.)

About the section/article doubt, just consider if the single sections can live "on their own". If they can (for example if your book is composed by short stories), then you can use articles. Otherwise sections are just fine.

PS: Consider using h2-6 too... because in theory you can use h1s all the way down for each section/article, but as it is now, for accessibility reason, it's better to stick to the usual h1-6 order. In your case it shouldn't be a problem (it could be a "problem" with reusable widgets that you don't know where exactly will end up).

Laz75
Thanks for the feedback! I appreciate it and will consider your comments. I've been thinking about using h1-h6 for subsections and keep every book section inside its <section> tag in order to make the book to a single page transition easy (adding the main h1 holding the title of the book outside).
expora