Are end tags allowed for void elements in HTML5? Were they allowed in prior versions of HTML, what is the reasoning. Coming from a XML background, void elements are allowed end tags so was not sure.
Asked
Active
Viewed 38 times
0
1 Answers
1
The reasoning behind start and end tags are to determine where an element starts and ends, so no they are not allowed since they have no content.
And this is from the spec page.
Void elements only have a start tag; end tags must not be specified for void elements.
![](../../users/profiles/6843077.webp)
HMZ
- 1,931
- 1
- 12
- 20
` (preferred in HTML 5), `
` and `
`. If you write `
` the opening tag is already interpreted as the full tag, while the `` is just considered a syntax error. – connexo Mar 12 '21 at 00:45