Search code examples
favicon

Html/Css how to change the background color of the favicon


I have a website favicon or head tag:

<head>
<link rel="icon" href="{% static 'images/favicon.png' %}" style="background-color: rgba(0, 56, 103, .94) !important;">
</head>

This will display here: enter image description here

My question is, how can I change the background color of this favicon.

I have tried to add css to it, and it doesn't work.


Solution

  • You define a favicon with a link tag. This tag doesn't accept style and can't be changed via CSS. You'll have to change the icon itself.

    You can learn more about the link tag at: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link.