我一直在尋找一個聰明的方式來創建特定格式的嵌套有序列表:有序列表
1. text
2. text
2.1 text
2.2 text
2.3 text
3. text
4. text
4.1 text
4.2 text
4.3 text
5. text
我試圖使用類型atrib在那裏,但它並沒有得到我在哪裏。 我不需要縮進....但是這將是不錯...
在此先感謝:d
我一直在尋找一個聰明的方式來創建特定格式的嵌套有序列表:有序列表
1. text
2. text
2.1 text
2.2 text
2.3 text
3. text
4. text
4.1 text
4.2 text
4.3 text
5. text
我試圖使用類型atrib在那裏,但它並沒有得到我在哪裏。 我不需要縮進....但是這將是不錯...
在此先感謝:d
使用counters爲
OL { counter-reset: item }
LI { display: block }
LI:before { content: counters(item, ".") " "; counter-increment: item }
OSOM!簡單真棒老兄:D,現在我只有一個小問題......第一個元素只顯示「1」,嵌套的元素很漂亮,但我希望第一個元素也顯示點「1」。 – 2013-02-15 17:28:20
我們需要看到更多的實際的HTML。你可以用CSS完成這種編號(小節)。
ol.main > li {
counter-increment: root;
}
ol.main > li > ol {
counter-reset: subsection;
list-style-type: none;
}
ol.main > li > ol > li {
counter-increment: subsection;
}
ol.main > li > ol > li:before {
content: counter(root) "." counter(subsection) " ";
}
我很難理解你想要完成什麼。這是靜態的HTML嗎?文本從哪裏來?你有什麼嘗試? – Coronus 2013-02-15 17:11:12
顯示您的HTML代碼 – 2013-02-15 17:12:24
看看:http://stackoverflow.com/questions/2729927/number-nested-ordered-lists-in-html – 2013-02-15 17:20:24