Home > Enterprise >  How to select a often used css class within a div
How to select a often used css class within a div

Time:10-21

What do i have to write to my css code to select .formlabel class within formblock2, for example to change the color of Heading B to green instead of red?

.formlabel {color:red;}
<div >
<div >
<div >Heading A
</div>
</div>
<div >
<div >Heading B
</div>
</div>
<div >
<div >Heading C
</div>
</div>
</div>

CodePudding user response:

you can call the parent of it then call the div that you want like this.

.formlabel {color:red;}

.formblock2 > .formlabel {color: green;}
<div >
<div >
<div >Heading A
</div>
</div>
<div >
<div >Heading B
</div>
</div>
<div >
<div >Heading C
</div>
</div>
</div>

  • Related