开发者

CSS Style assignment

开发者 https://www.devze.com 2023-03-11 01:34 出处:网络
I have this defined in an existing CSS sheet that I\'m 开发者_JAVA技巧working with: label.error-field

I have this defined in an existing CSS sheet that I'm 开发者_JAVA技巧working with:

label.error-field

To assign this to an html element do I simply do class="error-field" or do I add the label to have it be class="label.error-field"?


This is the right way:

<label class="error-field">My Label</label>


label.error-field is only applied to <label> elements with the class "error-field".

So if you want it on a label, then you'd just assign the class as "error-field", like this:

<label class="error-field">


This will only work on labels.

<label class="error-field">I'm an error label, yo ho ho</label>

The label. part is a CSS type (element) selector with a class (.) selector.


Add it simply to the label. class="error-field".


label.error-field will select an element label with a class of error-field

<label class="error-field">...</label>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号