I am currently trying to figure out how to transition my icons from black to white. The only way I could really find to do this properly was to use this: filter: invert (100%)
. When I try to transition it, it decides to change normally without a transition after the transition-delay
is done. I have 0 idea what I am doing wrong.
Here is the relevant CSS and HTML:
.links {
display: flex;
justify-content: space-between;
margin-left: 15px;
margin-right: 15px;
transition-delay: 500ms;
transition-timing-function: ease-in-out;
transition-property: filter;
}
.link-trans {
/* This is a class added to the <img> elements via JavaScript */
filter: invert(100%)
}
.usercard {
width: 310px;
box-shadow: 0 0 5px 2px rgb(233, 233, 233);
background-color: rgb(233, 233, 233);
border: solid 5px rgb(233, 233, 233);
border-radius: 5px;
transition-duration: 500ms;
transition-timing-function: ease-in-out;
}
.usercard:hover {
color: azure;
border-color: rgb(18, 18, 18);
background-color: rgb(18, 18, 18);
transform: scale(1.1);
margin-left: 20px;
margin-right: 20px;
}
.main {
display: flex;
justify-content: space-between;
margin-left: 100px;
margin-right: 100px;
margin-top: auto;
transform: translateY(15%);
}
<div class="main" id="main">
<div class="usercard">
<div class="links">
<a href=""><img src="./icons/website.png" alt="" class="icon"></a>
</div>
</div>
</div>
2
Answers
Transition duration good
Sorry, I wasn’t able to understand your CSS
Hope this helps
just add your
link-trans
class to img tagand change your css as