问题:
I have these divs that I'm styling with .tocolor , but I also need the unique identifier 1,2,3,4 etc. so I'm adding that it as another class tocolor-1 . 我有这些div,我正在使用.tocolor ,但我还需要唯一标识符1,2,3,4等,所以我将它添加为另一个类tocolor-1 。
<div class="tocolor tocolor-1"> tocolor 1 </div>
<div class="tocolor tocolor-2"> tocolor 2 </div>
<div class="tocolor tocolor-3"> tocolor 3 </div>
<div class="tocolor tocolor-4"> tocolor 4 </div>
.tocolor{
background: red;
}
Is there a way to have just 1 class tocolor-* . 有没有办法只有一个类tocolor-* 。 I tried using a wildcard * as in this css, but it didn't work. 我试着在这个css中使用通配符* ,但它没有用。
.tocolor-*{
background: red;
}
解决方案:
参考一: https://stackoom.com/question/LRPN/CSS中的通配符-用于类参考二: https://oldbug.net/q/LRPN/wildcard-in-CSS-for-classes
来源:oschina
链接:https://my.oschina.net/stackoom/blog/4270586