繁体   English   中英

是否可以隐藏选择:在订购列表中的内容之前

[英]Is it possible to hide selection of :before content in Ordered List

我有一个像这样的css和平:

ol li:before {
   content: counter(item) ". ";
   counter-increment: item;
   background: #afafaf;
   user-select: none;
}

现在, user-select: none; 阻止选择,但如果选择列表,则内容为:在标记为选中之前。 我想通过设置background-color: transparent来防止这种情况。 但是哪里? ol li:before::selection不起作用。

图片相关:

在此输入图像描述

Lorem ipsum文本被选中(涂成红色),我希望列表选择显得透明。

如果我使用所有浏览器前缀,那么它似乎适合我。

在此输入图像描述

ol li:before {
   content: counter(item) ". ";
   counter-increment: item;
   background: #afafaf;
   -webkit-touch-callout: none;
   -webkit-user-select: none;
   -khtml-user-select: none;
   -moz-user-select: none;
   -ms-user-select: none;
   user-select: none;
}

这是一个小例子: https//jsfiddle.net/0ft1z21L/ 1

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM