I am trying to display an "Icon" when hovering over each item individually. The issue I am facing is that when I hover over a child item, the parent item also displays its icon.
.list {
width: 150px;
height: 19px;
}
.list >.item {
background-color: #c3c3c3;
display: block;
margin-bottom: 40px;
margin-top: 12px;
border: 1px solid black;
color: white;
height: 30px;
}
.list .item .content {
position: relative;
width: 100px;
float: left;
display: block;
}
.list .item .actions {
position: relative;
color: red;
visibility: hidden;
}
.list .item:hover .actions {
visibility: visible;
cursor: pointer;
}
<ol class="list">
<li class="item">
<div class="content">
<span>1- Hi...</span>
</div>
<div class="actions">
<span class="icon">Icon 1</span>
</div>
<ol class="list">
<li class="item">
<div class="content">
<span>a- Hi 2...</span>
</div>
<div class="actions">
<span class="icon">Icon 2</span>
</div>
</li>
</ol>
</li>
<li class="item">
<div class="content">
<span>2- Hi 3...</span>
</div>
<div class="actions">
<span class="icon">Icon 3</span>
</div>
</li>
</ol>
Is there a way to achieve this using CSS?