background: url('./images/pattern.png'), linear-gradient(to bottom right, rgb(62,131,255), rgb(64,126,253), rgb(99,22,203), rgb(122,5,240));
这是上面的代码,我只想将不透明度应用于 png 图像而不是线性渐变颜色。有可能这样做吗?
提前致谢。
您可以使用::after
伪元素。
div#bg {
/* Assuming other properties are set */
background: linear-gradient(to bottom right, rgb(62,131,255), rgb(64,126,253), rgb(99,22,203), rgb(122,5,240));
}
div#bg::after {
content: '';
display: block;
width: 100%;
height: 100%;
background: url('./images/pattern.png');
opacity: 0.5;
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句