Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ordered Lists <OL>, Starting index with XHTML Strict?

Is there a way to start an ordered list from a specific index while following XHTML Strict? Using start=n works well, but has been deprecated… The intended purpose is to resume the index with paging.

I saw a few references to a CSS solution, but the starting index cannot be used like the attribute in the deprecated case of start.

like image 636
ccook Avatar asked Dec 30 '22 05:12

ccook


1 Answers

As kdgregory noted, counters would be the way to accomplish this and still maintain a valid document. This article on Array Studio shows how to code this in XHTML and CSS. The following is copied from their article:

You need to write the following in your CSS:

OL#page_one { counter-reset: item }
OL#page_two { counter-reset: item 5 }
LI { display: block }
LI:before {
    content: counter(item) ". ";
    counter-increment: item;
    display:block;
}

And, this is how your lists should be defined:

<ol id="page_one">
    <li>Division Bell</li>
    <li>Atom Hearth Mother</li>
    <li>Relics</li>
    <li>Dark Side of the Moon</li>
    <li>Wish You Were Here</li>
</ol>

<ol id="page_two">
    <li>The Wall</li>
    <li>More</li>
    <li>Piper at the gates of Dawn</li>
    <li>Final Cut</li>
    <li>Meddle</li>
</ol>
like image 176
Daan Avatar answered Jan 31 '23 09:01

Daan