I\'m generating a page for an upcoming portal site, and I\'ve got an HTML element with some optional content. I\'d like the element to not render if it is empty, but adding some
At the point where you populate the optional div
, if there is no text to put in it, try changing the CSS display
property to none.
According to this source (and others), display: none
removes the element completely from the document. It does not take up any space, even though the HTML for it is still in the source code.