I know I can remove p tags only with
being in them with JS/jQuery like so:
$("p").filter(function(){
return $.trim(this.innerHTML) === " "
}).remove();
But is it possible to target these with just CSS. Something like these doesn't work:
p[ ] { display: none; }
p:contains(' ') { display: none; }
Unfortunately this isn't possible with just CSS. :contains
used to be part of the CSS3 spec but has now been removed.
I have the same problem, and I solved with CSS pseudo selector: 'has:'
p:has(' ') {
display: none;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.