As you know, transparent is a color value, not an image value, like blue . Since this is a color value, it should be indicated last in the abbreviation background , and only there, because only the base layer can have a background color . That's why the Chrome Web Inspector reports an invalid property value with what you have.
Unfortunately, there is no way to use multiple backgrounds to indicate a single background image and its area that has been cut out (for example, to open a through hole in the middle of a section).
What you have on jsFiddle is a step. You can easily remove the extra div elements by adding pseudo-elements to both html and body instead of ::before and ::after , so you have four pseudo-elements to work with. You will also need to use background-size and background-position to properly adjust the gradient background so that they look seamless.
Since you want the gradients to be translucent, without any problems, you need to prevent them from matching. This is easy to do by adjusting the offsets as well as the background-size accordingly.
Here is the CSS I used:
html::before, html::after, body::before, body::after { display: block; position: fixed; background: linear-gradient(45deg, rgba(255, 0, 0, 0.5), rgba(0, 255, 0, 0.5)); content: ''; } html::before, html::after { height: 25%; left: 25%; right: 25%; background-size: 200% 400%; } body::before, body::after { width: 25%; top: 0; bottom: 0; background-size: 400% 100%; } html::before { top: 0; background-position: top; } html::after { bottom: 0; background-position: bottom; } body::before { left: 0; background-position: left; } body::after { right: 0; background-position: right; }
jsFiddle preview ( with borders to show how I organized the pseudo elements )
You canβt do it in just one box, so yes, it can work poorly on mobile devices. If this does not work too well, then you can use the SVG background to achieve this, or if it fails, you may have to revert to using traditional preliminary rendered background images.