css - 数据 uri 同时使用颜色

标签 css data-uri

我想知道是否有办法让背景同时具有数据 uri 和颜色。原来,我有这样的背景……

background:#222 url('data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==');

并且我希望我的数据 url 图像的 css 颜色高于 #222

这可能吗?

更新: 对于参与回答此问题的所有人,我深表歉意。我犯了一个小错误,没有替换 data-uri 代码而不是图像路径

谢谢

最佳答案

是的,你可以使用 color + url,只要按正确的顺序写就可以了:

When using the shorthand property the order of the property values is:

background-color background-image background-repeat background-attachment background-position It does not matter if one of the property values is missing, as long as the ones that are present are in this order.

Example

样式:

.bgnd{
    width:100%; 
    height:100px; 
    background: #ccc url("https://jsfiddle.net/img/logo.png");
}

HTML:

<div class="bgnd"></div>

关于css - 数据 uri 同时使用颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29298258/

相关文章:

html - 如何在链接下加点

javascript - 为什么 Flash 播放器在设置其容器 div 的较大高度时会在 Firefox 中崩溃?

使用 data-uri 的 css 游标

google-chrome - Chrome - 使用 "Save As..."网址时,右键单击菜单中禁用 "data"

c# - 将 datauri pdf 转换为文件以附加到电子邮件

保存时的 javascript 数据 URI 字符集

javascript - 添加 Bootstrap 轮播组件

html - 为响应式网站调整图像大小;不调整大小

html - 我无法在带有页脚主题的 wordpress 中将 1 行与 3 列分开

html - 为什么不能将 datauri img 复制到剪贴板?