Search code examples
htmlcsssvg-filters

SVG color change inside a button CSS


I am having a trouble changing the color of SVG along with the button. I want SVG color to change when I hover onto a button with SVG in it, now it works just when I hover over an SVG image inside that button. Here is what I got so far:

.round {
    display: inline-block;
    width: 120px;
    line-height:118px;
    background-color: rgba(100, 100, 100, 0);
    border:2px solid #0090ff;
    -webkit-border-radius: 200px;
    -moz-border-radius: 200px;
    border-radius: 200px;
    cursor:pointer;
    -webkit-transition: all .2s ease-out;
    -moz-transition: all .2s ease-out;
}

.round:hover {
    background-color: #00aaee;
    border:2px solid #0080b3;
}

.svg:hover {
    filter: brightness(1000%) saturate(0%) contrast(1000%);
}
<a href="/category/aktualnosci/" class="round"><img class="svg" src="/wp-content/uploads/2019/12/gazeta.svg" width="60" height="60"></a><br>


Solution

  • Something like : .round:hover .svg { filter: brightness(1000%) saturate(0%) contrast(1000%); }