Templates and plugins love to print an empty wrapper with a border and padding around nothing. A one-line CSS rule can hide it.
.notice:empty {
display: none;
}
:empty matches an element that has no children. That covers element nodes and text, including whitespace. Comments don’t count, so <div><!-- note --></div> still matches. Neither does CSS-generated content. It has worked in all browsers since July 2015.
MDN’s own example makes empty boxes lime and leaves the others pink:
.box { background: pink; }
.box:empty { background: lime; }
The caveat is whitespace. A line break or space inside the element is a text node, so <div> is not empty. That is what makes the rule fail on HTML that is formatted nicely by a template. A nested empty element, like
</div><div><p></p></div>, does not match either, because the <p> is a child.
Selectors Level 4 would let :empty match whitespace-only elements, but MDN says no browser supports that yet. So if you control the markup, print the tag with nothing between the brackets. If you don’t, you’ll need another route, such as hiding the wrapper where the template creates it.
Further reading: MDN: :empty