如何设置“标签”HTML元素的ID? [英] How to set the id of a 'label' HTML element?
问题描述
如果我有以下内容:
< label for =deletetxt>删除此文本< / label>
这里的'for'属性是什么?假设我不能为标签元素设置类来设计标签元素,我该如何设置这个元素的css?
两个问题,两个答案:
-
这里的'for'属性是什么?
这里告诉
< input>的标识符
标签引用的元素。当用户点击< LABEL>
时,某些浏览器将使用它来关注< input>
-
我如何为这个元素设置css?
如果你想CSS的所有标签元素:
标签{
/ *您的款式* /
}
B。如果您想标记该元素,则只需使用ID或类名即可。
If I have the following:
<label for="deletetxt">Delete This Text</label>
What is the 'for' attribute here? Is that the id?
Assuming that I cannot set a class for the label element to style the label element, how do i set css for this element?
Two question, two answers:
What is the 'for' attribute here?
It's here to tell the ID of the
<input>
element that label refers to. Some browsers will use it to set focus on that<input>
element when user clicks on that<LABEL>
how do i set css for this element?
A. If you want to CSS all label elements :
label { /* your styles */ }
B. If you want to label that element, just use IDs or classnames as you usually do.
这篇关于如何设置“标签”HTML元素的ID?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!