如何使用数字和字母顺序创建嵌套列表

时间:2015-06-07 16:31:38

标签: html css

我正在尝试将嵌套列表从数字更改为字母。您可以看到JsFiddle我在哪里上课alpha我希望3.1.1更改为a.任何想法?

strong {
   font-weight: 700;
  }

.maincontent ol {
  margin: 25px;
}

ol.tc li ol.d {
  list-style-type: lower-alpha !important;
  color: red;}

ol.tc {
    counter-reset: item;
}

ol.tc li {
    display: block;
    position: relative;
}
ol.tc li:before {
    content: counters(item, ".")".";
    counter-increment: item;
    position: absolute;
    margin-right: 100%;
    right: 10px; /* space between number and text */
}

ol.tc {
    counter-reset: item;
}
ol.tc li:before {
    content: counters(item, ".")".";
    counter-increment: item;
    position: absolute;
    margin-right: 100%;
    right: 10px; /* space between number and text */
}

ol.alpha {
    counter-reset: item;
    list-style-type: lower-alpha;
}

ol.alpha li:before {
    list-style-type: lower-alpha;
    position: absolute;
    margin-right: 100%;
    right: 10px; /* space between number and text */
    color: pink;
}
<ol class="tc">
  <ul>
    <li><strong>Preconditions</strong><br>
        <ol class="tc">
            <li>Before we can provide you with Pay Monthly Services, you will need to:</li>         
            <li>Complete our application process and provide us with any information which we reasonably ask for.</li>
            <li>Have a credit score and provide us with inancial security which is satisfactory to us. </li>
            <li>Provide us with valid proof of identity and evidence that you are permanently living in the Republic of Ireland.
             <li>Provide us with valid proof that you are aged over 18 years. </li>
        </ol>
      </li>

    <li><strong>Tariff Limits</strong><br>
      <ol class="tc">
           <li>Tariffs may include a limit on the volume of Services, including minutes, texts and/or internet access, which can be used without extra charge. Charges for all Services in excess of any Tariff limits will be charged at the rates set out in the charges.</li>
      </ol>
    </li>




    <li><strong>Call Charges covered by Tariff limits</strong><br>
      <ol class="tc">
          <li>Tariff limits cover calls made in Ireland to:
      <ol>
      
      <ol class="alpha">      
        <li>standard Irish landlines; and</li>
        <li>08 numbers allocated to Irish mobile network operators.</li>  
      </ol>
    </li> 



  </ul>
</ol>

3 个答案:

答案 0 :(得分:2)

html标记无效

val expect = new Expect4j(process.getInputStream(), process.getOutputStream())
expect.expect("Password for user@SOMETHING.COM:")
expect.send(password)

见下面的答案

&#13;
&#13;
<ol class="tc">
  <ul>
    <li>1</li>
    <li>2</li>
    <li>3</li>
  </ul>
</ol>
&#13;
strong {
   font-weight: 700;
  }

.maincontent ol {
  margin: 25px;
}

ol.tc li ol.d {
  list-style-type: lower-alpha !important;
  color: red;}

ol.tc {
    counter-reset: item;
}

ol.tc li {
    display: block;
    position: relative;
}
ol.tc li:before {
    content: counters(item, ".")".";
    counter-increment: item;
    position: absolute;
    margin-right: 100%;
    right: 10px; /* space between number and text */
}

ol.tc {
    counter-reset: item;
}
ol.tc li:before {
    content: counters(item, ".")".";
    counter-increment: item;
    position: absolute;
    margin-right: 100%;
    right: 10px; /* space between number and text */
}

ol.alpha {
    counter-reset: item;    
}

ol.alpha li:before {
    content: counter(item, lower-alpha) ". ";
     counter-increment: item;    
    position: absolute;
    margin-right: 100%;
    right: 10px; 
    color: pink;
    
}
&#13;
&#13;
&#13;

答案 1 :(得分:1)

以下是您要实现的目标的示例:

<ol type="1">
<li> Decide on a subject.
   <ol type="a">
   <li> Business
   <li> Family
   <li> Hobby
   </ol>
<li> Acquire the necessary tools and materials.
   <ol type="a">
   <li> Web browser
   <li> Text editor or HTML editor
   <li> Graphics and clip-art
   <li> Graphics editor
   </ol>
<li> Write the HTML source code.
</ol> 

只需在没有CSS代码的JFiddle内部尝试,然后根据您的意愿进行更改。

JFiddle example

答案 2 :(得分:1)

您拥有的HTML无效,<ol><ul>唯一允许的内容为零或<li>元素。

对于字母样式,您需要正确的伪content

.alpha li:before {
    content: counter(item, lower-alpha)".";
}

请参阅更新演示 - http://jsfiddle.net/sjqvpuuL/

ol {
    counter-reset: item;
}
li {
    display: block;
    position: relative;
}
li:before {
    content: counters(item, ".")".";
    counter-increment: item;
    position: absolute;
    margin-right: 100%;
    right: 10px;
}
.alpha li:before {
    content: counter(item, lower-alpha)".";
}
<ol>
    <li>
        <strong>Preconditions</strong>
        <ol>
            <li>Before we can provide you with Pay Monthly Services, you will need to:</li>
            <li>Complete our application process and provide us with any information which we reasonably ask for.</li>
            <li>Have a credit score and provide us with inancial security which is satisfactory to us.</li>
            <li>Provide us with valid proof of identity and evidence that you are permanently living in the Republic of Ireland.</li>
            <li>Provide us with valid proof that you are aged over 18 years.</li>
        </ol>
    </li>
    <li>
        <strong>Tariff Limits</strong>
        <ol>
            <li>Tariffs may include a limit on the volume of Services, including minutes, texts and/or internet access, which can be used without extra charge. Charges for all Services in excess of any Tariff limits will be charged at the rates set out in the charges.</li>
        </ol>
    </li>
    <li>
        <strong>Call Charges covered by Tariff limits</strong>
        <ol>
            <li>Tariff limits cover calls made in Ireland to:
                <ol class="alpha">
                    <li>standard Irish landlines; and</li>
                    <li>08 numbers allocated to Irish mobile network operators.</li>
                </ol>
            </li>
        </ol>
    </li>
</ol>