I am aware that !important is not recommended, and the few known use cases where it is appropriate includes when working with third party libraries such as Bootstrap. However, i would like to ask if this use case is appropriate too. Suppose i have a <div/> which i would want to animate from background-color transparent to a certain color. However, i would like to have a color change on hover too after the animation happens, but i can't seem to find a way to do it without using the !important rule. Thanks in advance!
div{
position: absolute;
width: 100px;
height: 100px;
animation: animate 4s forwards;
}
div:hover{
background-color: blue !important;
}
@keyframes animate{
from {
background-color: transparent;
}
to {
background-color: maroon;
}
}