当前位置: 首页 > 网络学院 > 网页制作基础教程 > HTML > HTML <label>标签

HTML
HTML Head
HTML Meta
HTML URLs
HTML Scripts
HTML 属性
HTML 事件
HTML URL-encode
HTML Web服务器
HTML 摘要
HTML 实例
标签列表
标准属性
事件属性
ASCII码
特殊字符
HTTP状态消息

HTML <label>标签


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-04   浏览: 886 ::
收藏到网摘: n/a

定义和用法

Defines a label to a control. If you click the text within the label element,  it is supposed to toggle the control.
为空间定义lable。当你按了label中的文字,可以让文字与控件联系在一起


在HTML和XHTML中的区别

NONE


提示与注意点

Note: The "for" attribute binds a label to another element. Set the value of the "for" attribute equal to the value of the "id" attribute of the related element.
注意:用"for"属性将label与另一个元素绑在一起。"for"属性值应该和相关的元素"id"属性值相同。


实例

代码 输出结果

<p>Try clicking on the text labels:</p>

<form name="input" action="">
<input type="radio" name="sex" id="male" />
<label for="male">Male</label>
<br />
<input type="radio" name="sex" id="female" />
<label for="female">Female</label>
</form>

Try clicking on the text labels:




可选属性

DTD indicates in which DTD the attribute is allowed. S=Strict, T=Transitional, and F=Frameset.
下表中的DTD列指明了被支持的DTD属性。S=Strict(精确的),T=Transitional(传统的),F=Frameset(框架)

属性 描述 DTD
for id_of_another_field Defines which form element the label is for. Set to an ID of a form element.
label为表单中的哪个元素所定义。

Note: If this attribute is not specified, the label is associated with its contents.
注意:如果这个属性没有指明,label会关联到它的内容

STF

标准属性

id, class, title, style, dir, lang, xml:lang

For a full description, go to Standard Attributes.
查看完整的属性

事件属性

accesskey, onfocus, onblur, onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup

For a full description, go to Event Attributes.
查看完整的属性


尝试与演示

Label
How to define a label to a control.
怎样为控件定义label

评论 (0) All

登陆 | 还没注册?