I'm making a client's website that has the following design in it:
As you can see, the 3 block have a variable content size, but the top is the same. It also has a subtle gradient that runs over the whole shape.
To accomplish the design, I made a parent div, with 2 child divs: .background & .content, which overlap each other (position + z-index).
Inside .background, I have 2 div's: .triangle & .block.
Since .triangle has a fixed height (220px), the gradient for .block can start at -220px: linear-gradient(yellow -220px, green 100%).
But the problem is that my .block div has a variable height, so I don't know where to end the .triangle's gradient.
Also if I use a border-image on .triangle, my triangle shape gets lost. I'd like to do it in CSS only if that's possible.
I've put a little JSFiddle together to make my problem more clear: https://jsfiddle.net/c1pgeq7j

Thanks to Adam Wathan for giving me the answer I was looking for: https://jsfiddle.net/c1pgeq7j/10
He ended up with no child-
divs in.backgroundand applying the following CSS to it:Only need to add the
-webkit-variant ofclip-path, so it's also supported in the newest version ofSafari.Thanks for trying to help me out people!