Answer the question
In order to leave comments, you need to log in
Svg image on top of another svg image on hover?
Hello. I am adding an svg image to the site. The task is to make, when hovering over, a change to another svg image. On the Internet I found how to change the fill color. This is not it.
<a href="{vk_url}" target="_blank" class="soc_vk"><svg class="icon icon-vk"><use xlink:href="#icon-vk"></use></svg></a>
.soc_vk:hover {
background-image: url(/templates/Default/images/hover_svg/vk_hover.svg);
}
Answer the question
In order to leave comments, you need to log in
If you do it via <use>, then 2 are required.
<svg class="icon icon-vk">
<use class='svg1' xlink:href="#icon-vk"></use>
<use class='svg2' xlink:href="#icon-hover"></use>
</svg>
.soc_vk:hover .svg1{ display: none; }
.soc_vk:hover .svg2{ display: inline; }
.soc_vk:not(:hover) .svg1{ display: inline; }
.soc_vk:not(:hover) .svg2{ display: none; }
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question