I need to make a button look flat on the :active state.
Let's say, for instance, I have:
button {
background:linear-gradient(#fc9, #ed8) /* some light orange gradient */
}
button:hover {
background:linear-gradient(#ed8, #da7) /* some darker orange gradient on hover */
}
button:active {
background:orange; /* And here I need just plane flat orange color */
}
<button>Click Me!</button>
But instead of that, I am getting the gradient from the previous state.
Are there any background CSS properties to kind of turn off that gradient?
e.g. blackground:liner-gradient-OFF; or background:no-inherit;
To add transparency, we use the rgba() function to define the color stops. The last parameter in the rgba() function can be a value from 0 to 1, and it defines the transparency of the color: 0 indicates full transparency, 1 indicates full color (no transparency).
To create the most basic type of gradient, all you need is to specify two colors. These are called color stops. You must have at least two, but you can have as many as you want.
What you really need is this:
button:active {
background-image: none;
background-color:orange;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With