html - 使用 CSS 为常规图像添加​​色调

标签 html css image

我在图像标签中有一个常规图像,如 this :

<img src="http://i.imgur.com/StEW4JD.jpg" class="image">

我想变成这个 image .我看到了混合模式的一些示例,但对于混合模式,您需要将图像设置为背景,但我在图像标签中有图像。

是否可以在不将图像设置为背景的情况下通过 css 将色调添加到图像中?

最佳答案

使用具有所需背景颜色的父图像。
比设置 mix-blend-mode: overlay; 到你的图像

img{max-width:100%;vertical-align:top;}


.blend-overlay{ mix-blend-mode: overlay; }
<div style="background:#822;">
   <img class="blend-overlay" src="https://i.imgur.com/StEW4JD.jpg">
</div>

https://stackoverflow.com/a/31528825/383904

关于html - 使用 CSS 为常规图像添加​​色调,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42341479/

相关文章:

php - 努力用 php 显示 blob 图像

javascript - 使 highcharts 中的标题可点击并使用 bootstrap popover?

javascript - Bootbox - 如何动态更改消息内容?

html - 对齐内容 : flex-end not shifting elements to container bottom

javascript - 诊断浏览器差异和问题的工具

html - 图像未出现在 HTML 中,而是出现在 Inspector 中?

linux - 使用 ImageMagick : too many exceptions and blinking problem 创建 GIF 图像时出错

html - 预代码块在居中的 flex 容器中将内容拉伸(stretch)到屏幕宽度之外

css - Link_to 中的变量格式

php - HTML 错误 : Display Inline-Block, 不是内联的?