csspseudo-class

CSS pseudo class for elements with no text


Is there a CSS pseudo class for elements with no text nodes like so:

div:nocontent {
    display: none;
}

I know that there is the :empty pseudo-class but the thing I want should ignore tags...

For example:

<div>
    <p></p>
</div>

Any solution for this?

EDIT:

For clarification it could be a syntax like this:

<div class="checker">
    <div class="somemarkupcontainerthatcomesfromthesystemandcantberemoved"></div>
</div>

And hide the whole thing like this (this would be optimal):

.checker:nocontent {
    display: none;
}

Solution

  • Yes, empty check if the node is empty (so with no text and no child nodes).

    There are no CSS-only options for your purpose.