Closing tags in Html5

In XHTML-based syntax, all elements need to be closed—either with a corresponding closing tag (like ) or in the case of void elements, a forward slash at the end of the tag. The latter are elements that can’t contain child elements (such as input, img, or link).

You can still use that style of syntax in HTML5—and you might prefer it for consistency and maintainability reasons—but it’s no longer required to add a trailing slash to void elements for validation. Continuing with the theme of "cutting the fat," HTML5 allows you to omit the trailing slash from such elements, arguably leaving your markup cleaner and less cluttered.

It’s worth noting that in HTML5, most elements that can contain nested elements—but simply happen to be empty—still need to be paired with a corresponding closing tag. There are exceptions to this rule, but it’s simpler to assume that it’s universal.
Related Tutorial
Follow Us #