目录搜索
文字
分享

HTML 5 <legend> 标签

定义和用法

<legend> 标签为 <fieldset>、<figure> 以及 <details> 元素定义标题。

HTML 4.01 与 HTML 5 之间的差异

在 HTML 4.01 中, <legend> 仅用于 <fieldset> 元素。

在 HTML 5 中, <legend> 标签应用于 <fieldset>、<figure> 以及 <details> 元素。

在 HTML 5 中,不支持 align 属性。请使用 CSS 代替。

例子

1

2

3

4

5

6

7

<fieldset>

<code><legend>健康信息:</legend></code>

<form>

<label>身高:<input type="text" /></label>

<label>体重:<input type="text" /></label>

</form>

</fieldset>

属性

标准属性

1

2

class, contenteditable, contextmenu, dir, draggable, id, irrelevant,

lang, ref, registrationmark, tabindex, template, title

如需完整的描述,请访问 HTML 5 中标准属性。

事件属性

1

2

3

4

5

onabort, onbeforeunload, onblur, onchange, onclick, oncontextmenu,

ondblclick, ondrag, ondragend, ondragenter, ondragleave, ondragover,

ondragstart, ondrop, onerror, onfocus, onkeydown, onkeypress, onkeyup,

onload, onmessage, onmousedown, onmousemove, onmouseover, onmouseout,

onmouseup, onmousewheel, onresize, onscroll, onselect, onsubmit, onunload

如需完整的描述,请访问 HTML 5 中事件属性。

TIY 实例

围绕数据的 Fieldse