Prevent collapse of divs and other elements

HTML CSS

To prevent the collapse of an empty HTML element you can simply add a pseudo CSS class with an space in it.
The following example will set it in the before pseudo class.

<div class="preventCollapse"><!-- I could be empty --></div>
.preventCollapse::before { content: "\200B" }

Reference

No known

History Mar 12, 2017