I have a button that needs to transition its color both when it's hovered and clicked. When clicked, I add it a class name called .selected
.
Setting transition property to the button makes every style transition which is unintentional.
.score-button {
width: 35px;
height: 35px;
border: 1px solid var(--fill-button-text8);
background-color: transparent;
border-radius: 23px;
color: var(--fill-button-text8);
cursor: pointer;
font-size: 18px;
font-weight: 600;
transition: linear 0.5s;
&:hover {
background-color: var(--fill-button-bg-hover);
}
&.selected {
border: none;
background-color: var(--primary-color);
color: var(--fill-button-text);
}
}