Did Chrome / Safari recently change the way mix-blend-mode is handled

南笙酒味 提交于 2020-01-02 04:54:10

问题


I made a webpage a couple of weeks ago, using the (then) recent version of Chrome (probably v56 or v57 but i dont know for sure), Safari and Firefox during development (on OSX). http://dirkluetter.de/projecttype/kamera

Firefox (v52 & v53) still displays the Page as intended.

While the most recent Chrome version (v58) does not anymore.

I used mix-blend-mode and background-blend-mode CSS properties which worked fine then - and still do on FF. Now Chrome / Safari seem to ignore the property, while Firefox still displays the page as intended. Did something change recently in the way Webkit browsers handle mix-blend-mode? i cant find any infos regarding a change on this ... there are several other questions regarding mix-blend-modes and chrome but the ones i checked where not related to mine.


回答1:


I'm not sure exactly what's going on, but I can get it to work in Chrome by adding background: white to the root element and moving the mix-blend-mode to a wrapper element inside of body.

html {
  background: white;
  display: flex;
  height: 100%;
}

body {
  margin: 0;
  background-blend-mode: luminosity;
  background-image: url(https://upload.wikimedia.org/wikipedia/commons/1/15/AreeiroMetroLx2.JPG);
  background-color: #006699;
  background-size: cover;
}

div {
  mix-blend-mode: multiply;
}

p {
  color: magenta;
}
<div>
<p> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam sollicitudin felis ultrices lacus venenatis, in porta dui sagittis. Aliquam maximus massa diam, ut elementum sem efficitur mollis. Proin mattis magna ante, sit amet semper nulla semper at. Vivamus hendrerit tortor nec lacus venenatis, vitae molestie odio consectetur. Vivamus fermentum id ligula et scelerisque. Etiam eu metus nec lacus aliquet convallis at sed mi. Integer euismod lorem risus, sit amet molestie mi egestas vitae. In quis consequat ligula. Pellentesque erat elit, ultricies et massa ut, cursus congue dolor. Suspendisse risus est, aliquet nec justo a, bibendum convallis justo.
</div>


来源:https://stackoverflow.com/questions/43503755/did-chrome-safari-recently-change-the-way-mix-blend-mode-is-handled

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