Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 932439
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T20:40:07+00:00 2026-05-15T20:40:07+00:00

I need to create a large table of contents for an HTML book but

  • 0

I need to create a large table of contents for an HTML book but I can’t decide what’s the best solution for its markup. I have two options in mind: definitions lists or ordered lists.

Would you consider this a personal style decision? And how about semantics?

I like my list to be numbered but I have problems using “ol” with nestes lists. I guess I’d do the same thing I did with my definition lists by numbering manually (and disabling style in my list).

I thought of these two:

Option A:

<div class="TOC">
    <dl>
        <dt><a href="#">Preface</a></dt>
        <dt>I. <a href="#">Chapter 1</a></dt>
        <dd>
            <dl>
                <dt>1 <a href="#">Section 1</a></dt>
                <dd>
                    <dl>
                        <dt>1.1 <a href="#">Subsection A</a></dt>
                        <dt>1.2 <a href="#">Subsection B</a></dt>
                        <dt>1.3 <a href="#">Subsection C</a></dt>
                    </dl>
                    <dt>2 <a href="#">Section 2</a></dt>
                </dd>
            </dl>
        </dd>
    </dl>
</div>

Option B:

<div class="TOC">
    <ol>
        <li><a href="#">Preface</a></li>
        <li><a href="#">Chapter 1</a>
            <ol>
                <li><a href="#">Section 1</a>
                    <ol>
                        <li><a href="#">Subsection A</a></li>
                        <li><a href="#">Subsection B</a></li>
                        <li><a href="#">Subsection C</a></li>
                    </ol>
                </li>
                <li><a href="#">Section 2</a></li>
            </ol>
        </li>
    </ol>
</div>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T20:40:07+00:00Added an answer on May 15, 2026 at 8:40 pm

    Definition lists are NOT strictly for “definitions” as some people seem to be saying – if they were they would have extremely few uses. However, while <dl/>s are very flexible and have many uses, the ordered-list does seem like a better option here.

    If you’re trying to number nested lists (whether they’re nested <ol/>s or <dl/>s), you can use CSS counter-increment and counter-reset properties to add numbers automatically based on the nested depth, rather than maintaining the numbering manually for every revision.

    Example:

    .TOC ol{
      list-style-type:none;
      counter-reset:toc1;
    }
    
    .TOC ol li::before{
      content:counter(toc1)' ';
      counter-increment:toc1;
    }
    
    .TOC ol li ol{
      counter-reset:toc2;
    }
    
    .TOC ol li ol li::before{
      content:counter(toc1)' .'counter(toc2)' ';
      counter-increment:toc2;
    }
    
    .TOC ol li ol li ol{
      counter-reset:toc3;
    }
    
    .TOC ol li ol li ol li::before{
      content:counter(toc1)' .'counter(toc2)' .'counter(toc3)' ';
      counter-increment:toc3;
    }
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i need create an email list sending to many emails. what is best solution
I need create clone repository. but I do not know where can I get
For a large web application I'm building, I need to create an extensive user
I need create a document word with Java. And I ask, how can I
I use MS SQL 2008 R2, I need create a Table with a CHECK
I have dynamically created WrapPanel (_wp) with several Borders. And I need create handler
I need to create a WP site which will have multiple subjects. Each subject
I have a very large table in Mathematica ((dimcub-1)^3 elements) coming from an inverse
I'm trying to create a table with each cell having a fixed width but
I'm studying Prism and need to create a small demo app. I have some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.