HTML
<legend>
element
represents a caption for the content of its parent
<fieldset>
.
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.
| 内容类别 | None. |
|---|---|
| 准许内容 | 措词内容 and headings (h1–h6 elements). |
| Tag omission | None, both the starting and ending tag are mandatory. |
| Permitted parents |
A
<fieldset>
whose first child is this
<legend>
element
|
| Implicit ARIA role | 无对应角色 |
| Permitted ARIA roles |
No
role
permitted
|
| DOM 接口 |
HTMLLegendElement
|
此元素只包括 全局属性 .
见
<form>
for examples on
<legend>
.
| 规范 | 状态 | 注释 |
|---|---|---|
|
HTML 实时标准
The definition of '<legend>' in that specification. |
实时标准 |
Definition of the
legend
element
|
|
HTML5
The definition of '<legend>' in that specification. |
推荐 | |
|
HTML 4.01 Specification
The definition of '<legend>' in that specification. |
推荐 | 初始定义 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
legend
|
Chrome 完整支持 Yes | Edge 完整支持 12 | Firefox 完整支持 1 | IE 完整支持 6 | Opera 完整支持 Yes | Safari 完整支持 Yes | WebView Android 完整支持 Yes | Chrome Android 完整支持 Yes | Firefox Android 完整支持 4 | Opera Android ? | Safari iOS 完整支持 Yes | Samsung Internet Android 完整支持 Yes |
完整支持
兼容性未知
<button>
<datalist>
<fieldset>
<form>
<input>
<label>
<legend>
<meter>
<optgroup>
<option>
<output>
<progress>
<select>
<textarea>