How to make so that for example the properties of the div div{} used only in second-level <div> attachments, but not inherited by divs and other elements that have 3rd and deeper nesting levels?

    1 answer 1

     div { color: orange; } .first > div { color: green; } .second > div > div { color: blue; } 
     <div class="first">div 1 <div>div 2 <div>div 3</div> </div> </div> <hr> <div class="second">div 1 <div>div 2 <div>div 3 <div>div 4 <div>div 5</div> </div> </div> </div> </div> 

    webref.ru | Child selectors