html - 如何在图像上放置透明彩色纸?

标签 html css image opacity rgba

有一张图片看起来像:

enter image description here

这张图片的副本看起来像:

enter image description here

我怎样才能在图像上放一张透明的蓝色纸?我试过这个:

<img src="bg2.jpg" style="background-color:rgba(34,70,118,0.7);" /> 

但是没有用。我该怎么做?

最佳答案

我猜是这样的

<div class="image-holder">
    <img src="http://i.stack.imgur.com/vqpYb.jpg">
    <div class="overlay"></div>
</div>

.image-holder {
    position: relative;
    float: left;
}
.overlay { 
    background-color:rgba(34,70,118,0.7);
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    z-index: 2;
}

http://jsfiddle.net/84L1cvmw/

关于html - 如何在图像上放置透明彩色纸?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25347989/

相关文章:

html - 水平居中表格行

javascript - HTML 中的复选框值

html - 访问链接上的伪类

javascript - 在 KineticJS 中调整图像对象的大小以进行形状填充

html - 将多边形三 Angular 形与 div 的底部对齐

html - 移除滚动条

javascript - script.aculo.us 切换出现在多个 div 上

Javascript获取文档中的字符,包括css和javascript

python - 如何从 Python Azure 存储下载 Blob 图像并从中创建图像对象?

c# - 将 WPF DrawingGroup 呈现为单个 ImageSource