I need help with displaying a hovered icon when hovering over it. I've implemented the following rules
.downloads-documentation__image:hover > svg:nth-child(1) {display:none;}
.downloads-documentation__image:hover > svg:nth-child(2) {display:block;}
The hover effect works on the first item in the list, but it doesn't work as expected on the second item. When I hover over the second item, the hovered icon disappears along with both hovered and non-hovered icons.
When inspecting in dev tools, the hovered element has display:block
, but the icon is not visible on hover.
*{outline:none;-webkit-box-sizing:border-box;box-sizing:border-box;}
ul,li{margin:0;padding:0;list-style:none;}
a{text-decoration:none;}
a{text-decoration:none;color:#00D3FF;}
.downloads-documentation__list{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;margin-left:0px;margin-right:0px;}
@media only screen and (max-width: 991px){
.downloads-documentation__list{max-width:600px;margin-left:auto;margin-right:auto;}
}
.downloads-documentation__item{position:relative;width:calc(100% / 12 * 3 - 0px * 2);margin-left:0px;margin-right:0px;}
@media only screen and (max-width: 991px){
.downloads-documentation__item{width:calc(100% / 12 * 6 - 0px * 2);margin-left:0px;margin-right:0px;margin-bottom:30px;}
}
@media only screen and (max-width: 575px){
.downloads-documentation__item{width:calc(100% / 12 * 12 - 0px * 2);margin-left:0px;margin-right:0px;}
}
.downloads-documentation__item::before,.downloads-documentation__item::after{content:'';background-color:rgba(36, 171, 146, 0.3);position:absolute;width:1px;height:60px;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);}
@media only screen and (max-width: 991px){
.downloads-documentation__item::before,.downloads-documentation__item::after{height:100px;}
}
@media only screen and (max-width: 991px){
.downloads-documentation__item::before,.downloads-documentation__item::after{height:100px;}
}
.downloads-documentation__item::before{left:0;}
@media only screen and (max-width: 575px){
.downloads-documentation__item::before{display:none;}
}
.downloads-documentation__item::after{right:0;}
@media only screen and (max-width: 480px){
.downloads-documentation__item::after{bottom:-18px;top:auto;right:auto;left:50%;-webkit-transform:translate(-50%, 0);transform:translate(-50%, 0);height:2px;width:100%;max-width:6rem;}
}
@media only screen and (min-width: 992px){
.downloads-documentation__item:first-child:before{display:none;}
.downloads-documentation__item:last-child:after{display:none;}
}
@media (min-width: 576px) and (max-width: 991px){
.downloads-documentation__item:nth-child(2n-1):before{display:none;}
.downloads-documentation__item:nth-child(2n):after{display:none;}
}
@media only screen and (max-width: 575px){
.downloads-documentation__item:last-child:after{display:none;}
}
.downloads-documentation__reference{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}
@media only screen and (max-width: 991px){
.downloads-documentation__reference{font-size:16px;}
}
.downloads-documentation__image{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;width:90px;height:80px;margin-bottom:20px;}
.downloads-documentation__image svg{-webkit-transition:0.2s;transition:0.2s;}
.downloads-documentation__image svg:nth-child(1){display:block;}
.downloads-documentation__image svg:nth-child(2){display:none;}
.downloads-documentation__image:hover{-webkit-transition:0.2s;transition:0.2s;}
.downloads-documentation__image:hover svg:nth-child(1){display:none;}
.downloads-documentation__image:hover svg:nth-child(2){display:block;}
<ul class="downloads-documentation__list">
<li class="downloads-documentation__item">
<a class="downloads-documentation__reference" id="item_4" href="" target="_blank">
<div class="downloads-documentation__image">
<svg xmlns="http://www.w3.org/2000/svg" width="82" height="70" viewBox="0 0 82 70">
<g fill="#05E2C2" fill-rule="nonzero">
<path d="M69.149 10H12.85C11.28 10 10 11.295 10 12.887v37.346c0 1.592 1.28 2.887 2.851 2.887h19.177l-1.42 5.037H26.44a.916.916 0 0 0-.91.921c0 .51.408.922.91.922H55.56c.503 0 .91-.413.91-.922a.916 (.*)