4 ms·
> The only way you know that <input /> is acceptable and <div /> isn't, is learning and remembering which elements self-close. It sucks, but that's the way it i
by arzke 3y ago
> The only way you know that <input /> is acceptable and <div /> isn't, is learning and remembering which elements self-close. It sucks, but that's the way it is.
People remember which elements self-close by repeatedly seeing them written as self-closing tags. So while it indeed makes no difference from the browser standpoint whether you're closing your self-closing tag or not, it can be valuable to beginners.
- jaffathecake 3y agoThere's a whole section in the article about the risk to beginners.
- arzke 3y agoWhich is the section I am quoting from.
- layer8 3y agoNo, people remember which elements self-close by remembering which elements can’t have meaningful content. In the days before XHTML, approximately nobody was confused about the distinction of which elements are self-closing and which have content.
- chrisfinazzo 3y agoYet you can still apply styles - to an extent - to most of these. Even just margin/padding will affect many of them.