HTML

Specifications

https://www.w3.org/TR/:

Doctype

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">

In HTML 5, this is an “obsolete permitted” doctype. In XML, DOCTYPE is a keyword, and must be uppercase. The html refers to the <html> root element. HTML 4 has it in uppercase, but in XHTML, element names must be lowercase.

Don’t put comments before the doctype; that can prevent recognition of the doctype.

Attribute values

Forms and controls

In HTML 4, the action attribute is required, but is allowed to be an empty URL. In HTML 5, it is not allowed to be empty, but is allowed to be omitted, which implies an empty URL. The reason for disallowing the explicit empty value seems to be due to confusion about whether the action URL is relative to a <base> element or not, and/or inconsistencies about the base with an empty URL: https://stackoverflow.com/questions/415234/forms-with-action/617197#617197.

Buttons: Prefer <input type=submit> over <button> where the content is text only. <Button> has more functionality and is favoured by MDN, but <input> is older, and IE6 had troubles with multiple submit <button> buttons.

With <input type=submit>, the value attribute is the button’s label. With multiple submit buttons, use unique name attributes to identify the button. Only the name and value of the activated submit button is submitted.

Need to specify type=submit?

Scripts

The <script type="text/javascript"> attribute is required by HTML 4, and is optional in HTML 5. The type for “intrinsic events” should be specified by <META http-equiv="Content-Script-Type" content="text/javascript">.