<output> Tag Syntax
<body> ... ... flow content expected ... <form id="form-id" method="GET|POST|etc." action="target-URL"> ... ... phrasing content expected ...<output>... phrasing content ... ... phrasing content ...</output>... ... </form> ... ... phrasing content expected ...<output form="form-id">... phrasing content ... ... phrasing content ...</output>... ... </body>
Rules for coding HTML output elements
Make sure you understand the difference between a tag and element and are familiar with the definitions of namespace and other HTML terms.
- Code the output element where phrasing content is expected, usually inside a form element.
- Begin the output element with a starting <output> 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. - If the field is for a form that can be submitted but is outside that form element, include a
form
attribute referencing the form the output is to be associated with. - Include any other attributes on the <output> tag as appropriate.
- Inside the output element, between the starting
<output>
tag and the ending</output>
tag, code the inner HTML phrasing content. - End the output element with a matching
</output>
closing tag.
Content Model
Contents of the output element
The content of the output element can include HTML comments, text content and only those HTML tags that can be used in phrasing content.