drhirn drhirn - 1 month ago 6x
CSS Question

Hide "non-element" using css

Following code:

<a href="...">bla</a>

How could I hide the "non-element" "hidethistext" with
using CSS without affecting everything else? Meaning, what would be the right selector?
Tried using
but that seemed not the right approach.


You can't. With css you can only select elements. The :not selector is used to select an element that is not of class x, does not have id y or is not element z. But hidethistext is just a textnode, which cannot be selected. The only solution is to wrap it in a <span/> element with another class then the first span