4
I have done a simple layout to demostrate this.
我做了一个简单的布局来说明这一点。
First, I will put 4 divs, the first to show the partial results, and the last to see the final result. The markup is just:
首先,我将放置4个div,第一个显示部分结果,最后一个显示最终结果。标记只是:
here box is just for dimensions, mesh1 to 3 hold the partial results, in mesh we put it all together.
这里的框仅用于尺寸,mesh1到3保持部分结果,在网格中我们将它们全部放在一起。
The CSS is:
CSS是:
.box {
width: 400px;
height: 150px;
position: relative;
display: inline-block;
}
.mesh1, .mesh {
background:
-webkit-linear-gradient(5deg, rgba(0, 250, 0, 0.5), rgba(0, 100, 0, 0.5))
}
.mesh:after, .mesh:before {
content: "";
position: absolute;
left: 0px;
bottom: 0px;
top: 0px;
right: 0px;
}
.mesh2, .mesh:after {
background: -webkit-radial-gradient(center center, circle cover, rgba(250, 0, 0, 0.6) 0%, rgba(120, 0, 10, 0.5) 100%);}
.mesh3, .mesh:before {
background: -webkit-radial-gradient(10% 10%, ellipse cover, rgba(0, 0, 250, 0.6) 0%, white 100%);}
I am giving to the mesh1 class a background linear, inclinated 5 degrees, and specifying colors in rgba format to allow for transparency.
我给mesh1类一个背景线性,倾斜5度,并指定rgba格式的颜色以允许透明度。
Then, to be able to overlay more gradients, I specify to pseudo elements as before and after, sharing the same layout properties.
然后,为了能够覆盖更多的渐变,我指定了前后的伪元素,共享相同的布局属性。
To the after element I give a circular gradient, shared with the mesh2 To the before element I give an elliptical gradient, off center. All of them can be rgba.
对于after元素,我给出一个圆形渐变,与mesh2共享。对于before元素,我给出一个椭圆渐变,偏离中心。所有这些都可以是rgba。
At the end, you see in the mesh div the result of overlapping everything
最后,您在网格div中看到重叠所有内容的结果
(I have used everywhere the webkit notation to make it short)
(我已经到处使用webkit表示法来缩短它)
I wouldn't say it is much artistic, but I leave this part to you :-)
我不会说这很有艺术性,但我把这部分留给你:-)
fiddle here