HTML 嵌套有序列表

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12574052/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 03:00:41  来源:igfitidea点击:

HTML nested ordered list

html

提问by jhchen

Possible Duplicate:
Proper way to make HTML nested list?

可能的重复:
制作 HTML 嵌套列表的正确方法?

I'd like to produce the following in HTML:

我想在 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:

但是根据正确的方法来制作 HTML 嵌套列表?这不是执行此操作的正确方法。“正确”的方式产生这个:

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?

那么,是否有一种正确的方法来嵌套有序列表而不会出现嵌套列表的额外数字?

回答by Eric

<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
    1. 内一
    2. 内二

<ul>is for *u*nordered lists.

<ul>用于*u*无序列表。

回答by Gloomcore

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

回答by KitWat

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>