How to fix Safari mix-blend-mode: color-dodge bug?

余生长醉 提交于 2021-01-29 13:50:59

问题


I want to achieve some text that sits on top of an image and using mix-blend-mode: color-dodge to make the text looks better.

Here is the example: https://codepen.io/pizza0502/pen/KepWGM

It works perfectly in Chrome and Firefox, but in Safari, the text that is not on top of the image will become white...any solution on this?


回答1:


Wrap your items in a container, isolate the container, and don't absolutely position your h1.

div {
  isolation: isolate;
}

h1 {
  font-size: 10rem;
  color: #fb4b6b;
  mix-blend-mode: color-dodge;
}

img {
  position: absolute;
  top: 200px;
  z-index: -1;
}
<div>
  <h1>Hello Mix Blend Mode</h1>
  <img src="https://source.unsplash.com/random"/>
</div>


来源:https://stackoverflow.com/questions/50628725/how-to-fix-safari-mix-blend-mode-color-dodge-bug

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!