尝试向我的轮播图像 (BS4) 添加图像色调,我最初的理解是使用
.tinted-image img {
background:
/* top, transparent red */
linear-gradient(
rgba(255, 0, 0, 0.45),
rgba(255, 0, 0, 0.45)
),
}
codepen 链接 - https://codepen.io/nightcoder21/pen/RyeYoz
这似乎有效,有没有人知道任何简单的方法来做到这一点?(我试图让我的代码尽可能简单和整洁)
先感谢您
把你的css改成这个
.tinted-image:before {
content: "";
display: block;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: linear-gradient(
rgba(255, 0, 0, 0.45),
rgba(255, 0, 0, 0.45)
);
}
你可以在这里查看:https : //codepen.io/anon/pen/rvqZvK
通过使用 :before 选择器,您可以为图像着色不同颜色 ^^
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句