开发者

CSS Selector not working on elements within a div

开发者 https://www.devze.com 2023-02-01 03:30 出处:网络
I have the following HTML structure: <div class=\"formFields\"> <label> Field 1: </label>

I have the following HTML structure:

<div class="formFields">
     <label> Field 1: </label>
     <input type="text" value="" name="field1" />
</div>

And my CSS selectors are as follows:

#formFields {clear:bot开发者_JAVA百科h;}
#formFields label {font-weight:bold;}

The clear:both; is being applied to the div, but the font-weight:bold; is not being applied to the labels. How would I apply this font-weight to the labels?


At the moment, none of the rules is being applied to the div.

  • # is the ID selector

  • . would be the class selector

so you'll either have to give the rules the class selector

.formFields

or give the div the ID formFields:

<div id="formFields">
0

精彩评论

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