2012-04-12 453 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

條款和條件通常是靜態頁面。因此,它是更好地使用人工訂單,而不是動態生成