Html有序列表1.1,1.2(嵌套计数器和范围)不工作 [英] Html ordered list 1.1, 1.2 (Nested counters and scope) not working

查看:184
本文介绍了Html有序列表1.1,1.2(嵌套计数器和范围)不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用嵌套计数器和范围来创建一个html有序列表。



这是我的代码:http://jsfiddle.net/qGCUk/2/



我希望得到以下结果:

  1。 one 
2. two
2.1。 two.one
2.2。 two.two
2.3。 two.three
3. three
3.1 three.one
3.2 three.two
3.2.1 three.two.one
3.2.2 three.two.two
4. four

相反,这是我看到的

  1。 one 
2. two
2.1。 two.one
2.2。 two.two
2.3。 two.three
2.4三个<! - 这是它出错了,当回到父 - >
2.1 three.one
2.2 three.two
2.2.1 three.two.one
2.2.2 three.two.two
2.3 four



我没有线索,有人看到哪里出错了吗?

解决方案

取消选中normalize CSS - http://jsfiddle.net/qGCUk/3/
在此默认情况下使用的CSS重置将所有列表边距和paddings设置为0



UPDATE http://jsfiddle.net/qGCUk/4/ - 您必须在您的主要< li>

 < ol> 
< li>一个< / li>
< li> two
< ol>
< li> two.one< / li>
< li> two.two< / li>
< li> two.three< / li>
< / ol>
< / li>
< li> three
< ol>
< li> three.one< / li>
< li> three.two
< ol>
< li> three.two.one< / li>
< li> three.two.two< / li>
< / ol>
< / li>
< / ol>
< / li>
< li>四< / li>
< / ol>


I use Nested counters and scope to create a html ordered list.

This is my code: http://jsfiddle.net/qGCUk/2/

I expect the following outcome:

1. one
2. two
  2.1. two.one
  2.2. two.two
  2.3. two.three
3. three
  3.1 three.one
  3.2 three.two
    3.2.1 three.two.one
    3.2.2 three.two.two
4. four

Instead, this is what I see (wrong numbering):

1. one
2. two
  2.1. two.one
  2.2. two.two
  2.3. two.three
2.4 three <!-- this is where it goes wrong, when going back to the parent -->
  2.1 three.one
  2.2 three.two
    2.2.1 three.two.one
    2.2.2 three.two.two
2.3 four

I have no clue, does anyone see where it goes wrong?

解决方案

Uncheck "normalize CSS" - http://jsfiddle.net/qGCUk/3/ The CSS reset used in that defaults all list margins and paddings to 0

UPDATE http://jsfiddle.net/qGCUk/4/ - you have to include your sub-lists in your main <li>

<ol>
    <li>one</li>
    <li>two
        <ol>
            <li>two.one</li>
            <li>two.two</li>
            <li>two.three</li>
        </ol>
    </li>
    <li>three 
        <ol>
            <li>three.one</li>
            <li>three.two
                <ol>
                    <li>three.two.one</li>
                    <li>three.two.two</li>
                </ol>
            </li>
        </ol>
    </li> 
    <li>four</li>
</ol>

这篇关于Html有序列表1.1,1.2(嵌套计数器和范围)不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆