section.slide [data-fragment-index] {
counter-increment: my-counter;
}
确定要获得
1, 2, 3, 4, and 5
,我得到1, 3, 3, 4, and 5
。
https://codepen.io/jmuheim/pen/wbnqegm?editors =1100
section.slide [data-fragment-index] {
counter-increment: my-counter;
}
.fragment {
position: relative;
}
.fragment::after {
position: absolute;
top: 3px;
right: 5px;
content: counter(my-counter);
background-color: #f28b48;
border-radius: 50%;
border: 2px solid #fff;
width: 16px;
font-weight: bold;
height: 16px;
text-align: center;
color: #fff;
}
本摘要相反,使用pseudo元素,在这种情况下,计数是您想要的 - 尚未被所有孩子递增的计数器。
after
li