Is there a way to apply a single CSS3 gradient background to multiple elements, where the gradient spans over the parent element but is only visible inside the child elements?
I came across this thread during my search: Applying gradient over multiple views
My issue is described in that thread, but I require a solution using CSS/HTML code.
In order to illustrate the problem, I created two images:
The first image shows the basic layout. The two <div>
s that require a gradient background are within a larger <div>
.
The second image demonstrates how the gradient smoothly transitions from element A to element B. While this effect can be achieved easily in image-editing software, I am seeking a CSS-only solution as using images may not be ideal.
I have experience with gradients, but haven't been able to figure out a solution for this specific issue on my own.
Any assistance would be greatly appreciated.
EDIT (06/01/15 13:30 GMT+1): It's important that Elements A and B can have rounded corners. The original idea was to use a radial-gradient for the spanning effect, but it's not a requirement. Perhaps this problem does not have a feasible solution.