How to Change SVG Colore with Hover
Easy Hover SVG Color Change Via Filter. Does not replace image on hover
This is a cool CodePen I found for hover SVG change you need to do it via a filter option here is an example of the HTML.
<div> <span class="icon icon-bike"></span> <span class="icon icon-bell"></span> <span class="icon icon-arrow"></span> </div>
CSS
.icon {
display: inline-block;
width: 70px;
height: 70px;
background-size: cover;
}
.icon-bike {
background-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/3/icon-bike-black.svg);
}
.icon-bike:hover,
.icon-bike:focus {
filter: invert(27%) sepia(51%) saturate(2878%) hue-rotate(346deg) brightness(104%) contrast(97%);
}
.icon-bell {
background-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/3/icon-bell-black.svg);
}
.icon-bell:hover,
.icon-bell:focus {
filter: invert(27%) sepia(51%) saturate(2878%) hue-rotate(346deg) brightness(104%) contrast(97%);
}
.icon-arrow {
background-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/3/icon-arrow-black.svg);
}
.icon-arrow:hover,
.icon-arrow:focus {
filter: invert(27%) sepia(51%) saturate(2878%) hue-rotate(346deg) brightness(104%) contrast(97%);
}
body {
display: grid;
height: 100vh;
margin: 0;
place-items: center center;
}
To get the filter code you can visit this CodePen: https://codepen.io/sosuke/pen/Pjoqqp
Original CodePen: https://codepen.io/chriscoyier/pen/jRgmJy