I have some server side HTML output I cannot deal with using pure CSS, essentially the DIV sometimes holds:
<div><span>Content</span></div>
or
<div><p>Content</p></div>
or
<div>Content</div>
or
<div> </div>
When the DIV == <div> </div>
I want to remove it.
Any ideas?
Hide empty divs - To hide the div set: display: none; in :empty selector · GitHub.
To hide an element, set the style display property to “none”. document. getElementById("element").
You can hide an element in CSS using the CSS properties display: none or visibility: hidden . display: none removes the entire element from the page and mat affect the layout of the page. visibility: hidden hides the element while keeping the space the same.
Nope! Divs can't be disabled. Only form and form elems. Actually in Quirks-mode IE can disable a div , but it only grays button texts, it doesn't prevent events firing.
You can do this using only CSS:
div:empty { display: none }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With