Latest web development tutorials

HTML label form attributes

HTML label tag Reference Manual HTML <label> tag

Examples

Located in form form outside the <label> element (but still form part of the form):

<form action="demo_form.html" id="form1">
<input type="radio" name="sex" id="male" value="male"><br>
<label for="female">Female</label>
<input type="radio" name="sex" id="female" value="female">
<input type="submit" value="提交">
</form>

<label for="male" form="form1">Male</label>

try it"

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support form property.


Definition and Usage

form attribute specifies <label> one or more form elements belongs.


Differences between HTML 4.01 and HTML5

form attribute is new in HTML5 attributes.


grammar

<label form=" form_id ">

Property Value

描述
form_id 规定 <label> 元素所属的一个或多个表单的 id 列表,以空格分隔。


HTML label tag Reference Manual HTML <label> tag