Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I remove gradient on :active state?

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;

like image 955
Alex Reds Avatar asked Nov 05 '12 19:11

Alex Reds


People also ask

How do you make a transparent gradient in CSS?

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).

What is the required number of colors to produce a gradient effect?

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.


1 Answers

What you really need is this:

button:active {
    background-image: none;
    background-color:orange;
}
like image 154
Devner Avatar answered Sep 21 '22 17:09

Devner