I want to pass CSS ::after content as a specific word from its class element.
If class names are "language-css", "language-html", etc, in this case, I want to pass the content as the word after the "-".
code::before {
content: attr(class);
}
<code class="language-css"> some code here </code>
<code class="language-html"> some code here </code>
<code class="language-javascript"> some code here </code>
I know this returns the whole text from the CSS class, does CSS support any split function as JavaScript does?
data-attributeand use this instead.code.language-css::before { content: "CSS"; }language-and instead using the class for the pseudo content, use the data-attribute . It could be:data-langage="html"