html - 将背景图像与 rgba 组合但没有渐变

标签 html css

是否可以使用 rgba 渐变将背景图像与 rgba 颜色组合?

目前我的 css3 样式是这样的:

html
{
    background: linear-gradient(rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0.75)),
    url("../icons/sombrero.jpg")no-repeat center center fixed;
}

但我想象的是这样的:

html
{
    background:rgba(0, 0, 0, 0.75),
    url("../icons/sombrero.jpg")no-repeat center center fixed;
}

rgba 颜色应位于图像上方。 我从 here 得到了渐变-'hack' .我在寻找渐变技术的替代方法,没有框阴影技巧。

最佳答案

将来可能会有。

来自 w3c 草案:

For example, one can use this as a simple way to "tint" a background image, by overlaying a partially-transparent color over the top of the other image:

background-image: image(rgba(0,0,255,.5)), url("bg-image.png"); 

background-color does not work for this, as the solid color it generates always lies beneath all the background images.

w3c documentation

关于html - 将背景图像与 rgba 组合但没有渐变,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30670449/

相关文章:

html - 如何在菜单中设置列表样式?

javascript - 切换 Canvas 上下文

html - 是否有一些标签可以提供 <p> 的功能而无需添加换行符?

html - 使用具有固定位置 div 的 Bootstrap 网格

javascript - 如何防止打开多个弹出窗口?

javascript - D3 JS 工具提示触发鼠标悬停事件

html - 覆盖背景颜色

jquery - 在使用 css 时删除悬停覆盖

javascript - Bootstrap 导航栏在调整大小时隐藏菜单元素

php - 如何将动态谷歌地图添加到我的网站?