HTML <output> tag

Updated: 11/13/2018 by Computer Hope
HTML output tag

When writing in HTML (hypertext markup language), the <output> tag is an inline element used to represent the result of a user's action or a calculation. A good example of an output is a computation performed by a script. The following sections contain information about this tag, including an example of it in use, and related attributes and browser compatibility.

Note

The <output> tag belongs to a group of tags called form elements.

Example of <output> code

<form oninput="x.value=parseInt(f.value)+parseInt(s.value)">0
<input type="range" id="f" value="10">100
+<input type="number" id="s" value="25">
=<output name="x" for="f s"></output>
</form>

Example result

0 100 + =

Tip

You may adjust the value inside the box by clicking either the up or down arrows on the right side.

Attributes

All HTML tags support standard attributes that define the settings of an HTML element. In addition to the standard settings, the <output> tag has the following unique attributes.

Attribute Description
for Designates the relationship between the calculation results, and the elements used in obtaining that result.
form Designates the form(s) containing the <output> element.
name Designates a name for the <output> element.

Compatibility

Edge Internet Explorer Firefox Safari Opera Chrome
All versions Not supported 4.0+ 7.0+ 11.0+ 10.0+

Additional form elements

Algorithm, Browser, Compatibility, Container tag, Nesting, URL, Web design terms