Home > other >  is it possible to edit a element inside a class in js / jsx how u can in css?
is it possible to edit a element inside a class in js / jsx how u can in css?

Time:08-14

I need to edit the css of some images in a class, but I'm doing it in a function, I've already done something similar but it directly edits a class, I need to know if I can do the same but edit only the img element of it.

CodePudding user response:

Someone has had a similar issue here. I believe the solution is to use nested classes:

<div >
     <img  src="./myPicture"/>
</div>

Then just edit the class as you would normally. If you want to add css to it, you can just use:

.myParentClass .myNestedClass {
       property: value;
    }
  • Related