Firefox混合混合模式错误

编程入门 行业动态 更新时间:2024-10-24 06:35:11
本文介绍了Firefox混合混合模式错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我目前需要使用混合混合模式为一个项目乘以黄色div上的图像。它在chrome中工作没有任何问题,但在firefox中,当容器具有与图像相同的宽度和高度时,图像将变黑。

I currently need to use mix-blend-mode for a project to multiply a image on a yellow div. It's working in chrome without any problems but in firefox, the image will turn black when the container has the same width and height as the image.

如果图像高1px它会运行反正。任何人都知道为什么会发生这种情况?

If the image is 1px higher it will run anyway. Anyone know why that happens?

这里是我的代码示例。尝试它在firefox和玩高度值。

Here is my code example. Try it in firefox and play around with the height value. It's going to turn black when you set the height to 500px.

感谢任何帮助人!

.image { background: #ffff00; display: block; width: 500px; height: 505px; } .image img { mix-blend-mode: multiply; }

<div class="image"> <img src="unsplash.it/500/500"> </div>

>

推荐答案

我发现你需要在图像后面设置一个背景颜色,并且为Firefox正确渲染div。因此,如果您的图像只占用了混合混合模式集的div的一部分,则包含或位于其余div的背景div需要一个颜色集,以便计算起作用。在设置背景颜色之前,我看到部分黑色div。

I found that you need to set a background color behind the image and div for Firefox to render properly. So if your image takes up only part of the div that has mix-blend-mode set, the background div containing or behind the rest of the div needs a color set for the calculation to work. I was seeing partial black divs before setting the background color.

这么说,你的例子似乎在Firefox 41中工作。

All that said, your example seems to be working in Firefox 41 as is now.

更多推荐

Firefox混合混合模式错误

本文发布于:2023-10-18 11:18:08,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1504083.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:错误   模式   Firefox

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!