【问题标题】:HTML list is showing III where it should be II [duplicate]HTML列表显示III应该是II [重复]
【发布时间】:2020-02-06 16:50:31
【问题描述】:

我只是使用简单的 HTML 来编写如下代码:

这就是我想写的代码:

但这是我得到的输出:

第 1.2 节应该从 II 而不是 III 开始,因为外部有序列表。

这是我正在使用的代码:

<h1>Table of Contents For My Book</h1>
<ol>
  <li>Chapter One</li>
  <ol type="I">
    <li>Section 1.1</li>
    <ol type="i">
      <li>First Topic</li>
      <li>Second Topic</li>
      <ul>
        <li>subtopic 1</li>
        <li>subtopic 2</li>
      </ul>
    </ol>
    <li>Section1.2</li>
    <li>Section1.3</li>
  </ol>

【问题讨论】:

  • 您的列表无效。请validate your HTML.
  • 将包含ol的列表项的结束&lt;/li&gt;移动到嵌套有序列表的结束&lt;/ol&gt;之后。与嵌套的ul 相同

标签: html html-lists


【解决方案1】:

尝试如下嵌套列表:

<h1>Table of Contents For My Book</h1>
<ol>
  <li>Chapter One
    <ol type="I">
      <li>Section 1.1
        <ol type="i">
          <li>First Topic</li>
          <li>Second Topic
          <ul>
            <li>subtopic 1</li>
            <li>subtopic 2</li>
          </ul>
         </li>
        </ol>
      </li>
      <li>Section1.2</li>
      <li>Section1.3</li>
    </ol>
  </li>
  <li>Chapter Two</li>
</ol>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-07-17
    • 2011-10-29
    • 1970-01-01
    • 1970-01-01
    • 2023-04-07
    • 1970-01-01
    • 2017-09-23
    • 1970-01-01
    相关资源
    最近更新 更多