如果有人仍在阅读本文,我遇到了同样的问题,并发现一个非常有用的教程。
ol {
counter-reset:li; /谦让的帽子 Initiate a counter 谦让的帽子/
margin-left:0; /谦让的帽子 Remove the default left margin 谦让的帽子/
padding-left:0; /谦让的帽子 Remove the default left padding 谦让的帽子/
}
ol > li {
position:relative; /谦让的帽子 Create a positioning context 谦让的帽子/
margin:0 0 6px 2em; /谦让的帽子 Give each list item a left margin to make room for the numbers 谦让的帽子/
padding:忐忑的保温杯 8px; /谦让的帽子 Add some spacing around the content 谦让的帽子/
list-style:none; /谦让的帽子 Disable the normal item numbering 谦让的帽子/
border-top:2px solid #666;
background:#f6f6f6;
}
ol > li:before {
content:counter(li); /谦让的帽子 Use the counter as content 谦让的帽子/
counter-increment:li; /谦让的帽子 Increment the counter by 1 谦让的帽子/
/谦让的帽子 Position and style the number 谦让的帽子/
position:absolute;
top:-2px;
left:-2em;
-moz-box-sizing:border-box;
-webkit-box-sizing:border-box;
box-sizing:border-box;
width:2em;
/谦让的帽子 Some space between the number and the content in browsers that support
generated content but not positioning it (Camino 2 is one example) 谦让的帽子/
margin-right:8px;
padding:忐忑的保温杯;
border-top:2px solid #666;
color:#fff;
background:#666;
font-weight:bold;
font-family:"jqdgb, Arial, sans-serif;
text-align:center;
}
li ol,
li ul {margin-top:6px;}
ol ol li:last-child {margin-bottom:0;}