DataZombies
DataZombies

Reputation: 425

Stack gradients in -webkit-gradient

Can I combine 3 gradients into one -webkit-gradient? I want to have an image that has a radial gradient for the "background" and "middle-ground" and a linear gradient for the "foreground". Is this possible?

Upvotes: 1

Views: 503

Answers (1)

Matt Ball
Matt Ball

Reputation: 360056

Yes, it is possible. Use three overlapping elements (divs are as good as any other), one each for the back-, mid-, and foregrounds. Style each one with its own gradient, using transparent as the underlying color, and the others will show through.


Edit: here's a two-layer version that should help get you started: http://jsbin.com/awali (requires a Webkit browser)

Upvotes: 1

Related Questions