2012-04-12 456 views
2

我必须在HTML中制作条款和条件页面,所以我想给他们一个数字,但一些条件有他们的分,所以我想像下面的例子那样展示他们。在html中的订单列表

  1. 我第一点

    1.1和我子点

  2. 我第二点

  3. 我第三点

  4. 我第四

    4.1和我的子点牛逼

可以使用CSS

<style> 
ol {list-style:decimal} 


</style> 
</head> 

<body> 
<ol> 

<li>me the first point 
<ol><li>me the sub point</li></ol> 

</li> 
<li>me the second point</li> 
<li>me the third point</li> 
<li>me the forth point</li> 


</ol> 

</body> 
+0

你可以在这里找到答案 - http://stackoverflow.com/questions/956178/html-css-outline-numbering或在这里 - http://stackoverflow.com/questions/1852816/nested-ordered-lists – 2012-04-12 04:07:34

回答

3

您可以使用CSS 计数递增。像这样写:

body{ 
    counter-reset: chapter 0; 
} 
li{ 
    counter-reset: sub-chapter 0; 
    margin-left:20px; 
    position:relative; 
} 
li:before{ 
    counter-increment: chapter; 
    content: counter(chapter) ". "; 
} 
li li:before{ 
    counter-increment: sub-chapter; 
    content: counter(chapter) "." counter(sub-chapter) ": "; 
} 
li:before{ 
    position:absolute; 
    left:-20px; 
} 

入住这http://jsfiddle.net/gNqXL/

它的工作,直到上述IE8 &。

0

条款和条件通常是静态页面。因此,它是更好地使用人工订单,而不是动态生成