Is it possible to target <p>&nbsp;</p> with just CSS?


I know I can remove p tags only with &nbsp; being in them with JS/jQuery like so:

    return $.trim(this.innerHTML) === "&nbsp;"

But is it possible to target these with just CSS. Something like these doesn’t work:

p[&nbsp;] { display: none; }
p:contains('&nbsp;') { display: none; }


Unfortunately this isn’t possible with just CSS. :contains used to be part of the CSS3 spec but has now been removed.

Answered By – kmoe

Answer Checked By – Jay B. (AngularFixing Admin)

Leave a Reply

Your email address will not be published.