Search code examples
htmlcssimagecolorspng

Instagram symbol don't change color when hoover it, the problem is the format?


My HTML code:

<header>
            <div class="logo">
                <img src="imagens/mascote.png" alt="" />
            </div>
            <nav>
                <ul>
                    <li>
                        <a href="#">Home</a>
                    </li>
                    <li>
                        <a href="#">Eventos</a>
                    </li>
                    <li>
                        <a href="#">Lojinha</a>
                    </li>
                    <li>
                        <a href="#">Parcerias</a>
                    </li>
                    <li>
                        <a href="#">
                            <div class="icon">
                                <img src="imagens/insta.png" alt="" />
                            </div>
                        </a>
                    </li>
                </ul>
            </nav>
    </header>

My CSS code:

*, html {
    margin:0;
    padding:0;  
}

.logo img{
    height: 100%;
}

.logo{
    height: auto;
    margin: 10px;
}

header {
    display: flex;
    margin: 0px;
    top: 0px;
    width: 100vw;
    height: 100px;
    background: #000000;
    alling-items: center;
}

nav {
    display: flex;
    justify-content: space-between;
    alling-items: center;
    margin: 30px 100px 0 600px;
    z-index: 100;
}
nav ul {
    display: flex;  
    alling-items: center;
    justify-content: space-between;
    gap: 100px;
    list-style: none;
}

nav ul li a {
    font-family: "Inter", sans-seriff;
    font-weight: 100;
    font-size: 20px;
    line-height: 36px;
    color: #FFFFFF;
    text-decoration: none;
}

a:hover {
    color: #0000FF;
  }

.icon img:hover {
    color: #0000FF;
  }
  

.icon img{
    margin: -5px;
}

Everything is working as I want, but the Instagraam icon doesn't be blue when I hover it. Why is thins happening? How can I solve this? It's because I should work with a svg icon, orcan I do this with a png? Thanks for attention.

I tried so many ways to the png color changes to blue (the original png is white), but nonehas worked, this last was my best try.


Solution

  • The best option seems to change the image url when hovering over it. This can be done like so:

    <div class="image-container">
      <img src="original-image.png" alt="Original Image" />
    </div>
    
    .image-container {
      background-image: url(original-image.png);
    }
    
    .image-container:hover {
      background-image: url(hover-image.png);
    }