[whatwg] List captions

Michel Fortin michel.fortin at michelf.com
Fri Apr 6 07:56:11 PDT 2007


Le 2007-04-06 à 10:27, Andy Mabbett a écrit :

>     <ul>
>       <caption>Animals</caption> (or lh, or whatever)
>       <li>Cat</li>
>       <li>Dog</li>
>       <li>Horse</li>
>       <li>Cow</li>
>     </ul>

Personally, I can hardly see why such a markup is needed.

If your list is part of the main content you should be preceding it  
by a header the same way you would for a paragraph. If the list is  
for navigation, why not simply wrap it in a <nav> element alongside  
with a header? If the list is somewhat separate of the main content,  
it probably belongs, with the header, in an <aside> element. If the  
list is for some illustrative purpose, a case were like a table it  
needs a caption, why not improve the <figure> element to allow lists  
to be put inside it?

More visually, which case do you have that would not be covered by  
any of these markups?

     <h1>Animals<h1>
     <ul>
       <li>Cat</li>
       <li>Dog</li>
       <li>Horse</li>
       <li>Cow</li>
     </ul>


     <section>
       <h1>Animals<h1>
       <ul>
         <li>Cat</li>
         <li>Dog</li>
         <li>Horse</li>
         <li>Cow</li>
       </ul>
     </section>


     <nav>
       <h1>Animals<h1>
       <ul>
         <li>Cat</li> <!-- assuming you have some links here -->
         <li>Dog</li>
         <li>Horse</li>
         <li>Cow</li>
       </ul>
     </nav>


     <aside>
       <h1>Animals<h1>
       <ul>
         <li>Cat</li>
         <li>Dog</li>
         <li>Horse</li>
         <li>Cow</li>
       </ul>
     </aside>


     <figure>
       <legend>Animals</legend>
       <ul>
         <li>Cat</li>
         <li>Dog</li>
         <li>Horse</li>
         <li>Cow</li>
       </ul>
     </figure>


I believe the markup should depend on what your list stands for. A  
list is not much unlike a paragraph: it's an enumeration formatted in  
a special way. So why can't we reuse the already existing structures?



Michel Fortin
michel.fortin at michelf.com
http://www.michelf.com/





More information about the whatwg mailing list