2

I just want to change png image background to blue when hover without using other image. Just only css. I've that css filters do the job so I tried few methods but no luck. I used css filter greayscale methord. Is there any to change background color to this #05adef other than greyscale? Here is the fillde

img{
  width: 120px;
}

img:hover{
   filter: grayscale(100%);
}
<img src="https://cdn.freebiesupply.com/logos/large/2x/fox-news-logo-png-transparent.png" alt="">

1

1 Answer 1

2

Use background-color:#05adef

alternatively you can use hue-rotate(deg) but the catch is that you have to search for the perfect angle to match the desired color. Also use invert and contrast in conjunction for more control over the color.

img{
  width: 120px;
}

img:hover{
filter:invert(100%) hue-rotate(24deg);
 
}
<img src="https://cdn.freebiesupply.com/logos/large/2x/fox-news-logo-png-transparent.png" alt="">

2
  • Not this way. and not as an overlay. I need to change image colors. IS that possible?
    – Janath
    Commented Jan 21, 2020 at 5:42
  • This is great! Can't we change the black color background to blue?
    – Janath
    Commented Jan 21, 2020 at 5:50

Not the answer you're looking for? Browse other questions tagged or ask your own question.