here I have to change after background-color on hover sub menu li first child only for the first child I want to change bg color. I had tried using selector ~
but still not working can anyone suggest me in the right direction.
.main {
position: relative;
}
.main:after {
content: 'After';
position: absolute;
top: -10px;
width: 50px;
height: 15px;
background-color: red;
}
.demo:first-child:hover .main:after { background-color: blue;}
<ul class="main">
<li>
test
<ul class="demo">
<li><a>change bg after</a></li>
<li><a>test2</a></li>
</ul>
</li>
<li>test</li>
<li>test</li>
<li>test</li>
</ul>