Reputation: 12985
I've been experimenting with xhtml and now I'm wondering that is there a valid/correct way to add empty elements.
Short question, but here's the two ways I've been using:
<div> </div>
<div> </div> <!-- Same as space -->
Upvotes: 1
Views: 517
Reputation: 4743
<div />
is valid XTHML for an empty element: i.e. self-closing. Same as
<div></div>
Upvotes: 0
Reputation: 546035
Like this:
<div></div>
A space inside an element is not "nothing" - it's a text node which makes the element non-empty.
Upvotes: 3