HTML <legend> 元素用于表示其父元素 <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.
内容分类 | 无。 |
---|---|
允许的内容 | 语句内容(Phrasing content)。 |
标签忽略 | 不允许,开始标签和结束标签都不能省略。 |
允许的父元素 | <fieldset> ,并且<legend> 作为第一个子元素 |
Implicit ARIA role | No corresponding role |
Permitted ARIA roles | No role permitted |
DOM 接口 | HTMLLegendElement |
属性
这个元素只有全局属性。
示例
在 <form>
中查看关于 <legend>
元素的示例。
规范
规范 | 状态 | 注释 |
---|---|---|
HTML Living Standard <legend> |
Living Standard | Definition of the legend element |
HTML5 <legend> |
Recommendation | |
HTML 4.01 Specification <legend> |
Recommendation | Initial definition |
浏览器兼容
BCD tables only load in the browser
另请参阅
- 其他与表单相关的元素:
<form>
,<option>
,<label>
,<button>
,<select>
,<datalist>
,<optgroup>
,<fieldset>
,<textarea>
,<keygen>
,<input>
,<output>
,<progress>
和<meter>
。 - ARIA: Form role