0

I have a css style like:

    button.gradient {
        background: -moz-linear-gradient(top, #00ff00 0%, #009900 50%, #00dd00);
        background: -webkit-gradient(linear, left top, left bottom, from(#00ff00), color-stop(0.50, #009900), to(#00dd00) );
    }

It is a green button with gradient background color. How can I change the background color from green to blue using javascript while keeping the gradient effect?

1 Answer 1

1

Neither Firefox nor Chrome use the prefixed version any more, and haven't for quite some time.
Source: http://caniuse.com/#search=gradient

So make your life easier, just use the correct syntax:

background-image: linear-gradient(to bottom, #0f0, #090, #0d0);

Then you can simply change the gradient as desired.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.