Is there any way to to specify styling for all tags that start with some prefix?
For example:
tst-* {
display: block;
background: yellow;
}
<tst-some-tag>Some content</tst-some-tag>
The reason why I want such selector is because I'm using Angular and have lots of custom components. All of them should be displayed as block
. It could be very comfortable to specify display
property for all custom elements ones, instead of adding class every time, when I use them.
If you want to select elements by class-name you could do this: [class^='class']
If you want to select elements by id simply do this:
[id^='id']
In both cases you select all elements witch start with the text you put between the single quotation marks, either by class-name or by id.
Variations are also possible:
div[class^='class']
or div[id^='id']
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With