[whatwg] List captions

Thomas Broyer t.broyer at gmail.com
Fri Apr 6 07:57:57 PDT 2007


2007/4/6, Andy Mabbett:
> >
> >We should do our best to avoid repeats of alt, title, and friends.
>
> Why?

Styling, text extraction (a.k.a. tag-stripping)

> >A list  header would go much better as a separate element, like
> ><caption> is for  tables.
>
> Like:
>         <ul>
>           <caption>Animals</caption> (or lh, or whatever)
>           <li>Cat</li>
>           <li>Dog</li>
>           <li>Horse</li>
>           <li>Cow</li>
>         </ul>
>
> Yes, that would work, too.

Problem: not backwards compatible (w.r.t. styling)
See this page with different browsers:
http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20html%3E%0A%3Cbody%3E%0A%3Cstyle%20type%3D%22text/css%22%3Eul%20caption%20%7B%20text-decoration%3A%20underline%3B%20%7D%3C/style%3E%0A%3Cul%3E%3Clh%20style%3D%22color%3A%20green%22%3ECaption%3C/lh%3E%3Cli%3EItem%201

You can also try with <lh>, almost same results (much better in Firefox).
http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20html%3E%0D%0A%3Cbody%3E%0D%0A%3Cstyle%20type%3D%22text/css%22%3Eul%20lh%20%7B%20text-decoration%3A%20underline%3B%20%7D%3C/style%3E%0D%0A%3Cul%3E%3Clh%20style%3D%22color%3A%20green%22%3ECaption%3C/lh%3E%3Cli%3EItem%201

Better results with <p>, but not semantically a good choice.

Using an <ul> or <ol> nested inside a <dl> is not that bad after all...

-- 
Thomas Broyer



More information about the whatwg mailing list