Why use HTML5 tags? [duplicate]

It’s not an either-or situation. HTML5 still has <div>s. It still has <span>s. The new tags are there to give you more expressive freedom and to standardize common elements. For instance, most pages have navigation bars, yet so far there was no standard for how those were marked up. If they’re clearly marked up as … Read more

Are self-closing input tags valid in HTML 4?

The syntax is valid in some places but doesn’t mean the same as in XHTML, so don’t use them. In HTML 4 <foo /> (where foo is the name of an element defined as EMPTY) means the same as <foo>> which means the same as <foo>&gt; (although almost no browser supports the syntax correctly, Emacs-W3 … Read more

HTML: Include, or exclude, optional closing tags?

There are cases where explicit tags help, but sometimes it’s needless pedantry. Note that the HTML spec clearly specifies when it’s valid to omit tags, so it’s not always an error. For example you never need </body></html>. Nobody ever remembers to put <tbody> explicitly (to the point that XHTML made exceptions for it). You don’t … Read more