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

HTML
HTML 介绍
HTML 元素
HTML 基本标签
HTML 格式
HTML 实体字符
HTML 链接
HTML 框架
HTML 表格
HTML 列表
HTML 表单
HTML 图片
HTML 背景
HTML 颜色
HTML 颜色值
HTML 颜色名
HTML 便条
HTML 布局
HTML 字体
HTML 4.0
HTML 样式

HTML <label>标签


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-04   浏览: 885 ::
收藏到网摘: 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

登陆 | 还没注册?