After testing the colleagues solution I saw that there was a problem, which I believe to be rendering, in FireFox, Edge and IE. As seen in the image
MysolutionwastouseanSVGinline,insteadofbackground-image
:Thatwaywithjustafewlinesyoucanmakeagridbackgroundeveneasiertocustomizethandonewithlinear-gradiente
,norequestismadeontheserverbecausetheSVG
isinlineanditwasalsopossibletomakeafallbackwithanotherbackgraund
iftheuser'sbrowserdoesnotsupportSVG.(recomendoquetestemnoIEcasotenhaminteresseparaverqueeleusaosegundoURLcomo
backgroundeignoraoprimeiro)
ofeachsquareyoucanhaveadifferentgradient...
body {
background-image:
url("data:image/svg+xml;utf8,\
<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 100 100'>\
<rect fill='%23000' width='50' height='50' x='0' y='0' />\
<rect fill='%23000' width='50' height='50' x='50' y='50' />\
<rect fill='%23fff' width='50' height='50' x='50' y='0' />\
<rect fill='%23fff' width='50' height='50' x='0' y='50' />\
</svg>"),
url(https://abrilveja.files.wordpress.com/2018/01/mallandro.png);
background-size: 80px, cover;
}
Below a result shown the versatility of colors in bg if you want something different.
body {
background-image:
url("data:image/svg+xml;utf8,\
<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 100 100'>\
<defs>\
<linearGradient id='grad1' x1='0%' y1='0%' x2='100%' y2='0%'>\
<stop offset='0%' style='stop-color:rgb(255,255,0);stop-opacity:1' />\
<stop offset='100%' style='stop-color:rgb(255,0,0);stop-opacity:1' />\
</linearGradient>\
</defs>\
<rect fill='url(#grad1)' width='50' height='50' x='0' y='0' />\
<rect fill='black' width='50' height='50' x='50' y='50' />\
<rect fill='blue' width='50' height='50' x='50' y='0' />\
<rect fill='%23fff' width='50' height='50' x='0' y='50' />\
</svg>"),
url(https://abrilveja.files.wordpress.com/2018/01/mallandro.png);
background-size: 30px, cover;
}
html, body {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
position: relative;
}
body::before, body::after {
content:"";
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
background-image: repeating-linear-gradient(to right, #000 0, #000 40px, #fff 40px, #fff 80px);
}
body::after {
background-image: repeating-linear-gradient(to bottom, #000 0, #000 40px, #fff 40px, #fff 80px);
mix-blend-mode: difference;
}