HTML中有序列表标记的使用,html – 如何在使用start属性的有序列表中设置标记样式?...

您可以使用计数器重置和反增量属性.您必须在列表项上使用:before伪元素.

这是一个例子.

首先,你必须启动柜台.您可以使用counter-reset属性执行此操作.

ol {

counter-reset: item 49;

list-style: none;

}

计数器重置的语法如下

counter-reset: none|name number|initial|inherit;

在这里,我们给出了名称,然后是您想要开始的号码.由于默认情况下从0开始,因此您要选择49而不是50.

我们终于可以开始设计我们的数字,使它看起来很漂亮.我们使用:before伪元素执行此操作.在content属性中,我们可以包含我们使用上面的counter-reset属性定义的计数器的值.

li:before {

margin-right: 10px; // Gives us breathing room after number

padding: 3px;

content: counter(item);

background: lightblue;

border-radius: 100%; // Gives circle shape

color: white;

width: 1.2em;

text-align: center;

display: inline-block;

}

ol {

counter-reset: item 49;

list-style: none;

}

li {

counter-increment: item;

margin-bottom: 5px;

}

li:before {

margin-right: 10px;

padding: 3px;

content: counter(item);

background: lightblue;

border-radius: 100%;

color: white;

width: 1.2em;

text-align: center;

display: inline-block;

}

  1. Coffee
  2. Tea
  3. Milk

还应注意,计数器重置和反增量仅适用于IE8或更高版本.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值