I have designed a CSS button with a unique effect - the background color fades lighter on mouseover and immediately becomes darker on mousedown. However, I am facing an issue where I want to keep the button's hover state even after the mouseup event without repeating the transition. Is there a way to achieve this?
.btn1 {
background-color: #08f;
border-top: 0;
border-right: 0;
border-bottom: 3px solid #048;
border-left: 0;
border-radius: 20px;
color: #fff;
font-size: 16pt;
padding: 10px 20px;
transition: background-color 0.5s;
}
.btn1:hover {
background-color: #0cf;
}
.btn1:active {
background-color: #048;
border-top: 3px solid #fff;
border-bottom: 0;
color: #888;
transition: background-color 0s;
}
<body>
<button class="btn1">Click Me</button>
</body>