Void Element With Closing Tag
ID |
html.empty_tag |
Severity |
low |
Remediation Complexity |
low |
Remediation Risk |
low |
Remediation Effort |
low |
Resource |
Reliability |
Language |
Html |
Tags |
reliability |
Rationale
Void elements such as br, img and input never take a closing tag because they have no content.
A stray closing tag is invalid markup: some browsers ignore it while others insert an extra line
break, so the page renders differently across engines.
<br></br> <!-- FLAW — </br> is invalid -->
<br> <!-- OK — void element, no closing tag -->
Remediation
Remove the closing tag from void elements; a single <br>, <img …> or <hr> is complete on its
own.