<output>

HTML <output> 标签表示计算或用户操作的结果。

Content categories 流式元素短语元素listed, labelable, resettable  form-associated element, palpable content.
允许元素 短语元素
省略标签 不允许,开始标签和结束标签都不能省略。
允许父元素 接受任何 短语元素
允许ARIA角色 Any
DOM 接口 HTMLOutputElement

属性

这个标签具有 全局属性

for
其它影响计算结果的标签的ID,可以多个。
form
与当前标签有关联的form(从属的表单)。该属性的值必须是当前文档内的表单元素的ID。如果未指明该属性,output标签必须是一个form的后代标签。该属性的用处在于可以让output标签脱离form标签,存在于一个网页文档的任意位置。
name
name属性。

例子

<form oninput="result.value=parseInt(a.value)+parseInt(b.value)">
    <input type="range" name="b" value="50" /> +
    <input type="number" name="a" value="10" /> =
    <output name="result"></output>
</form>

规范

Specification Status Comment
HTML Living Standard
<output>
Living Standard  
HTML5
<output>
Recommendation  

浏览器兼容

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
outputChrome Full support 10Edge Full support ≤18Firefox Full support 4IE No support NoOpera Full support 11Safari Full support 7WebView Android Full support YesChrome Android Full support YesFirefox Android Full support 4Opera Android ? Safari iOS Full support YesSamsung Internet Android Full support Yes
forChrome Full support 10Edge Full support ≤18Firefox Full support 4IE No support NoOpera Full support 11Safari Full support 7WebView Android Full support YesChrome Android Full support YesFirefox Android Full support 4Opera Android ? Safari iOS Full support YesSamsung Internet Android Full support Yes

Legend

Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown

参见