Am trying to use keyframes to change the background color of an a tag
My code:
.button-container {
width: 200px;
height: 40px;
display: flex;
margin: 0 auto;
}
.button-container a{
width: inherit;
height: inherit;
text-align: center;
display: flex;
align-items: center;
justify-content: center;
background-image: linear-gradient(to right, #000, #000);
}
.button-container:hover a{
animation: colorswitch 5s linear;
}
@keyframes colorswitch {
from {
background-image: linear-gradient(to right, #ddd , #ddd);
}
to {
background-image: linear-gradient(to right, #ddd , #ddd);
}
}
<div class="button-container">
<a href="#">View here</a>
</div>
How can I change the background color of the a tag from #000 to #ddd moving from left to right when I hover over it?