there is a block inside of which there are two blocks of the same name, only one is directly inside the parent, and the second has several more wrappers. How to apply the style only to the child "son"?

.cild { background: #CDDC39; display: inline-block; margin: 5px; padding: 5px; } 
 <div class='parrent'> <div class='cild'>сын</div> <div class='folder'> <div class='cild'>внук</div> </div> </div> 

  • .parrent> .cild { - splash58

1 answer 1

There is a selection through > (only the first level of heirs).

This is done like this:

 .parrent > .cild { } 

Documentation about selectors

  • I corrected the Russian language, but it is better to completely remove the second sentence :) - splash58
  • @ splash58 wow, that was certainly wrong, thank you so much. When I wrote for some reason I did not think about it, and I saw a mistake, but did not correct it. The evening is coming :) - Vasily Barbashev