I need to blend the background colors of 2 elements using CSS
I have been fiddling around with the background-blend-mode:multiply
but that works only when I have the 2 colors in the same element.
I need to achieve something like this –
I have been searching a lot but haven’t been able to figure it out.
Most helpful resource I found was New blending features in CSS which shows how to do it using Canvas.
Is it possible to do the same thing using CSS?
EDIT
The circles above were just an example to show what I needed. As I mentioned, I was looking for blending colors for 2 different elements. I have created a fiddle for my actual shapes that I need to blend.
http://jsfiddle.net/fmgfsr4o/2/
2
Answers
Try this pure CSS3, although you will need to figure out how to position the circles.
JSFiddle
You can combine CSS multiple background with radial-gradients to achieve this effect:
CSS
HTML
I have done a JSFiddle for you to try: http://jsfiddle.net/pomeh/07nLpwwj/
This is the result I get using Firefox 31:
Even if the browser support seems “correct” (see here http://caniuse.com/#feat=css-backgroundblendmode), please note that the
background-blend-mode
property has the Candidate Recommendation status for now, so be careful when using it (thanks to @Paulie_D for pointing that out).