嵌套的不同类型的有序列表

时间:2016-09-22 16:53:33

标签: html html5

我目前正在尝试嵌套几个有序列表html标记,并将它们作为单独的类型。但是,所有列表元素都保留为类型1,我无法说明原因。

这是我的代码:

<ol type="1">
    <li>Sales Associate 2003- Present</li>
    <ol type="2">
        <li>Target West, Wichita, KS</li>
            <ol type="3">
                <li>Help customers with purchases</li>
                <li>Handle customer questions and complaints, working to ensure complete customer satisfaction</li>
                <li>Run cash register</li>
                <li>Monitor security system</li>
            </ol>
    </ol>

    <li>Grounds Keeper 1998-2003</li>
    <ol type="2">
        <li>Riverside Golf Course, Wichita, KS</li>
            <ol type="3">
                <li>Helped with the general outdoor maintenance of the apartment complex</li>
                <li>Worked as a member of a team</li>
                <li>Scheduled maintenance repairs with tenants as needed</li>
            </ol>
    </ol>

</ol>

2 个答案:

答案 0 :(得分:1)

您不能将ol作为另一个ol的直接子项,它必须嵌套在li中。

<ol type="1">
    <li>Sales Associate 2003- Present
       <ol type="2">
           <li>Target West, Wichita, KS
               <ol type="3">
                   <li>Help customers with purchases</li>
                   <li>Handle customer questions and complaints, working to ensure complete customer satisfaction</li>
                   <li>Run cash register</li>
                   <li>Monitor security system</li>
               </ol>
           </li>
       </ol>
   </li>
....
</ol>

此外type 2和3不是有效的属性值。

有效的属性是:

  • 1代表十进制数字(例如1. 2. 3. ...等)
  • a代表小写拉丁字母(例如a.b.c. ...等)
  • A代表大写拉丁字母(例如A. B. C.等等)
  • i代表小写罗马数字(例如,i。ii。iii。......等)
  • I代表大写罗马数字(例如I. II.III ....等)

答案 1 :(得分:0)

您必须将新列表包装成li元素,如下所示:

<li> Text
 <ol>
  <li>...</li>
 </ol>
</li>