Asked
Active
Viewed 28 times
0
I would like to know whether is there a way in css to apply a rule to all containers including a certain string.
For example:
I have: class="hello-english", class="goodbye-english" and class="tomorrow-english"
Is there a way to select all classes containing the string "english" in the class name?
Thanks

setnaps
- 39
- 4
-
Technically yes i suspect something like: `div[class*="english"] { .... }` could work; but it's a pretty sloppy selector. – Raxi Jan 03 '22 at 16:14
-
Do you want all the classes which have 'english' anywhere in their name whih is what your text suggests or do you want just those classes which end in '-english' which is what your example suggests. – A Haworth Jan 03 '22 at 17:10
1 Answers
0
Check out attribute selectors.
That's basically, (or at least one answer to it)
element[class$="-english"] {
...insert rules here
}

Franrey Saycon
- 647
- 1
- 5
- 18