Is it possible to create an ordered list like the following? I like this for a table of contents I'm creating.
I have the following but each subsection restarts from 1.
<ol>
<li>
<a href="#Lnk"></a>
</li>
<li>
<a href="#Lnk"></a>
</li>
<ol>
<li>
<a href="#Lnk"></a>
</li>
<li>
<a href="#Lnk"></a>
</li>
</ol>
</ol>
Thanks
You first declare the table with the <table> markup, and then the rows with the <tr> markup. (table row.) Inside each row, you can declare the data containers <td> . (table data).
Creating Tables in HTML You can create a table using the <table> element. Inside the <table> element, you can use the <tr> elements to create rows, and to create columns inside a row you can use the <td> elements. You can also define a cell as a header for a group of table cells using the <th> element.
They can contain all sorts of HTML elements; text, images, lists, other tables, etc.
This can indeed be done with pure CSS:
ol {
counter-reset: item;
}
li {
display: block;
}
li:before {
content: counters(item, ".")" ";
counter-increment: item;
}
Same example as a fiddle.
There's quite a number of jQuery plugins to generate a table of contents.
Look at this one for starters
Another one here, with ordered lists
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With