2012-04-12 4 views
2

나는 html로 이용 약관 페이지를 만들어야하므로 번호를주고 싶지만 일부 조건에는 하위 포인트가 있으므로 아래 예와 같이 표시하고 싶습니다.html로 주문 목록

  1. 날 제 포인트

    1.1 내게 서브 포인트

  2. 내게 번째 점

  3. 내게 번째 포인트

  4. 내게 항

    4.1 나에게 하위 포 인 t는

당신이 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 –

답변

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; 
} 

확인 위의 IE8 &까지이 http://jsfiddle.net/gNqXL/

그것의 일을.

1

나는이 귀하의 요구 사항에 맞는 생각 대신에 동적으로 생성하는 수동 순서를 사용하는 것이 좋습니다.

http://caniuse.com/#search=counter

See example.

괜찮은 방향으로 가리킬 수 있습니다.

0

CSS는이 작업을 수행 할 수 있습니다 그래서