13

Possible Duplicate:
Proper way to make HTML nested list?

I'd like to produce the following in HTML:

1. One
2. Two
  1. Inner One
  2. Inner Two
3. Three

One way is

<ol>
  <li>One</li>
  <li>Two</li>
  <ol>
    <li>Inner One</li>
    <li>inner Two</li>
  </ol>
  <li>Three</li>
</ol>

But according to Proper way to make HTML nested list? this is not the proper way to do this. The "proper" way produces this:

1. One
2. Two
3.
  1. Inner One
  2. Inner Two
4. Three

So, is there a proper way to nest ordered lists without extra numbers appearing for the nested lists?

Community
  • 1
  • 1
jhchen
  • 14,355
  • 14
  • 63
  • 91
  • Why do you think the `3.` is in there? It's nesting, not another `li`. – Jared Farrish Sep 24 '12 at 22:58
  • For instance: http://jsfiddle.net/userdude/xuh6z/1 Note, you want `ol`, not `ul` too. – Jared Farrish Sep 24 '12 at 22:58
  • Did you actually try reading the answers to [Proper way to make HTML nested list?](http://stackoverflow.com/questions/5899337/proper-way-to-make-html-nested-list) – Eric Sep 24 '12 at 23:03
  • Both examples in [Proper way to make HTML nested list](http://stackoverflow.com/questions/5899337/proper-way-to-make-html-nested-list) actually give the desired output, but with a little correction: `
      ` to `
      `
    – Nikola K. Sep 24 '12 at 23:04

3 Answers3

31
<ol> 
  <li>One</li> 
  <li>Two
    <ol> 
      <li>Inner One</li> 
      <li>inner Two</li> 
    </ol>
  </li>
  <li>Three</li> 
</ol> 

gives

  1. One
  2. Two
    1. Inner One
    2. inner Two
  3. Three

<ul> is for *u*nordered lists.

Eric
  • 95,302
  • 53
  • 242
  • 374
3

I think, you are searching for this:

<ol>
  <li>One</li>
  <li>Two
  <ol>
    <li>Inner One</li>
    <li>inner Two</li>
  </ol>
  </li>
  <li>Three</li>
</ol>

Outputs to:

1. One
2. Two
   1. Inner One
   2. Inner Two
3. Three
David
  • 2,053
  • 2
  • 16
  • 26
Gloomcore
  • 940
  • 7
  • 11
-3

As stated above you just need an ordered list

<ol>
  <li>one</li>
  <li>two</li>
  <ol>
      <li>inner 1</li> 
      <li>inner 2</li>
  </ol>
  <li>three</li>
</ol>
KitWat
  • 35
  • 2
  • 4