<button> Tag Syntax

<body>
   ...
   ... flow content expected ...
   <form id="form-id" method="GET|POST|etc." action="target-URL">
      ...
      ... phrasing content expected ...<button>... phrasing content ...</button>...
      ...
   </form>
   ...
   ... phrasing content expected ...<button form="form-id">... phrasing content ...</button>...
   ...
</body>
Rules for coding HTML button elements

Make sure you understand the difference between a tag and element and are familiar with the definitions of namespace and other HTML terms.

  1. Code the button element where phrasing content is expected, usually inside a form element.
  2. Begin the button element with a starting <button> tag. The element name uses lower case letters and should be in the HTML namespace, which it will pick up automatically from the xmlns attribute on the <html> tag.
  3. If the button is for a form that can be submitted but is outside that form element, include a form attribute referencing the form the button is to be associated with.
  4. Include any other attributes on the <button> tag as appropriate.
  5. Inside the button element, between the starting <button> tag and the ending </button> tag, code the inner HTML phrasing content.
  6. End the button element with a matching </button> closing tag.
Content Model
Contents of the button element

The content of the button element can include HTML comments, text content and only those HTML tags that can be used in phrasing content.