0
CSS style based on tag content
Hello everybody! Is it possible to do different for example text colours dependent on what’s tag contains? I mean If tag <a> contains(text) “login” it is red coloured But if <a> contains(text) “logout” it is blue coloured Text inside “” is just text, not classes, ids. Please do not show me JavaScript examples, I want to handle this by just css, best regards, Eterxoz
5 ответов
+ 1
Just add id atrributes of login and logout, set the css selectors accordingly.
+ 1
Eterxoz I know that you look for css to check for text content, unfortunately it's not possible for css to check for text node now.
0
Calviղ Thanks for help, but as i mentioned i want different styles based on content, not id/classes.
0
Eterxoz for your study, using JavaScript is another option.
https://code.sololearn.com/Wc6q6gha2q4L/?ref=app
0
Calviղ I know javascript is an another option. Just wondering if it is possible with just css. I found something like „contains” pseudoclass, but in documentations it is not explained in any proper way. Just an space with „to be filled” is left. Anyway thanks for help!
for others: It is not possible yet(06.01.2019).
best regards,
Eterxoz