Heim > Fragen und Antworten > Hauptteil
P粉7648364482023-08-22 20:00:10
使用这个样式仅改变嵌套列表:
ol { counter-reset: item; } ol > li { counter-increment: item; } ol ol > li { display: block; } ol ol > li:before { content: counters(item, ".") ". "; margin-left: -20px; }
P粉1419112442023-08-22 14:47:16
取消选中“标准化CSS” - http://jsfiddle.net/qGCUk/3/ 在此中使用的CSS重置将所有列表的边距和填充设置为0
更新 http://jsfiddle.net/qGCUk/4/ - 您必须在主要的<li>
中包含您的子列表
ol { counter-reset: item } li { display: block } li:before { content: counters(item, ".") " "; counter-increment: item }
<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>