How to select those tag with css ? Like this :
<style type="text/css">
[attribute*="test"] {
background-color: red;
}
</style>
but it's not work for tag
<test-1>
</test-1>
<test-2>
</test-2>
<test-3>
</test-3>
How to select those tag with css ? Like this :
<style type="text/css">
[attribute*="test"] {
background-color: red;
}
</style>
but it's not work for tag
<test-1>
</test-1>
<test-2>
</test-2>
<test-3>
</test-3>
You cannot select elements using the attribute selector, because, well it's for attributes. As far as I know you cannot use wildcards to select elements. You will need e.g. Javascript to select your elements and add classes or attributes which you can then target using CSS. In any case I would try to avoid these kind of wild card selectors for performance reasons.
See also: CSS Wildcard element name selection
pls try this code:
<test-1 class="ts">1
</test-1>
<test-2 class="ts">2
</test-2>
<test-3 class="ts">3
</test-3>
<style>
[class*="ts"] {
background: #ffff00;
}
</style>