HTML <output> Tag

Description

The <output> HTML tag is used to represent the result of a calculation or a user's input within the context of a mathematical or computational operation. It is a semantic HTML5 element that helps provide structure and meaning to the content on a web page. Typically, <output> tags are used in conjunction with other HTML elements, such as <form> elements and JavaScript, to display the outcome of calculations or user interactions, making it easier for both users and developers to understand and manipulate data on a webpage.

Properties

Permitted Parents
Any element that accepts phrasing content
Content
Inline and text
Start/End Tags
Start tag: required, End tag: required

Example

<form oninput="x.value=parseInt(a.value)+parseInt(b.value)">0
<input type="range" id="a" value="50">100
+ <input type="number" id="b" value="50">
= <output name="x" for="a b"></output>
</form>

Attributes

Attribute Definition
for Specifies the relationship between the result of the calculation, and the elements used in the calculation
form Associates the output with a form
name Specifies the name of this element

Global Attributes

The <output> tag also supports the Global Attributes in HTML5

Event Attributes

The <output> tag also supports the Event Attributes in HTML5

Browser Support

The following table will show you the current browser support for the HTML <output> tag.

Desktop
Edge Chrome Firefox Opera Safari
18104117
Tablets / Mobile
Chrome Firefox Opera Safari Samsung Webview
18411714.4

Last updated by CSSPortal on: 30th March 2024