也就是说,看下面:
<div class="helloeverybody">
</div>
<div class="heyeveryperson">
</div>
我想将 css 规则应用于每个类,其中包含单词“every”。 这个有正式名称吗?
最佳答案
您可以通过在属性后附加星号来使用“包含” 属性选择器 - 例如
div[class*=every] {
color: orange;
}
来自 Selectors Level 3 的定义:
Represents an element with the att attribute whose value contains at least one instance of the substring "val". If "val" is the empty string then the selector does not represent anything.
关于css - 如何将 CSS 规则应用于其中包含特定关键字的类?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18163533/