I am currently working on achieving a unique effect with three background gradients, including a horizontal mask, top border, and bottom border to seamlessly blend borders into the background:
In order to achieve this effect, here is the code snippet I have been using (with browser prefixes repeated multiple times):
background:
linear-gradient(to right, rgba(200,100,40,1) 0%,rgba(250,235,115,0.5) 50%,rgba(200,100,40,1) 100%),
linear-gradient(to top, rgba(240,175,30,1) 0%,rgba(240,175,30,0) 2px),
linear-gradient(to bottom, rgba(250,235,115,1) 0%,rgba(250,235,115,0) 2px) ; /* W3C */
Despite almost achieving the desired effect, I am facing an issue where the edges of the mask are full opacity (1), while the background does not consistently feature a solid color, resulting in certain problems.
Currently, my solution involves modifying all background code to ensure that the fading starts after surpassing the top mask and the bottom background color reaches full opacity before reaching the bottom mask. However, this approach is cumbersome and inflexible, going against the principles of CSS3.
I have come across some suggestions on fading out borders ('Fade' borders in CSS), which propose setting the border color as a gradient. Yet, I have yet to see this method work effectively, and most discussions on this topic are outdated.
Below is the representation without the "mask":
EDIT: SOLUTION: http://jsfiddle.net/turnosaurus/SWVJJ/