编辑:我忘了提到非常重要的事情,我无法编辑基本 html,只能编辑 css。这是一个 reddit 样式表。
我想在图像背景上有一个半透明的彩色背景作为色调。这是我尝试过的:这只是显示图像:
background: url(image) no-repeat, rgba(0,0,0,0.5);
这显示了图像并打破了它的缩放比例(背景大小:100%;):
background: rgba(0,0,0,0.5), url(image) no-repeat;
这使背景完全变黑,透明度逐渐消失在它后面而不是图像:
background-image: url(image) no-repeat;
background: rgba(0,0,0,0.5);
这再次只显示图像,并打破缩放:
background-image: url(image) no-repeat;
background-color: rgba(0,0,0,0.5);
这仅显示图像而不会破坏缩放:
background: url(image) no-repeat;
background-color: rgba(0,0,0,0.5);
我尝试使用@Trevan 的答案也没有运气:
#header:lang(dd) {
position: relative;
background: url(%%HexBackground%%) no-repeat;
}
#header:lang(dd)::before {
position: absolute;
content: "";
top: 0;
left: 0;
background: rgba(0,0,0,0.5);
}
我可能做错了。