I have nested list items, to show its nested li i'm giving padding left to 25px;
When i hover on nested li(class = .child), i want to show background to red and wants it background to start from left parent edge, because of padding(25px), it is just showing background from child edge.
here in my demo if i say it, red hover(123, 456, 789) should start from li(Abc)
ul {
list-style:none;
}
.child {
padding-left:25px;
}
li {
line-height:1.5;
border-bottom:0.5px solid wheat;
cursor:pointer;
}
li:hover.child {
background:red;
}
.ol {
border-bottom:0.5px solid red;
}
.ol:hover {
background:blue;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
</head>
<body>
<ul>
<li class="dept">
<div class="ol"> Abc </div>
<ul>
<li class="child"><a><spa>123</span></a></li>
<li class="child"><spa>456</span></a></li>
<li class="child"><spa>789</span></a></li>
</ul>
</li>
<li class="dept">Efg</li>
</ul>
</body>
</html>