So, I think I solved the problem. During the animation, it seems that the body is not considered an element, so yellow appears in 1 opacity. I tested in a different blending mode and it always looks yellow. (if set to "difference", the expected result will be white, not yellow)
So fix it? just add a div with 100% dimensions and a black background! Then the yellow color has something that can be mixed and will not appear.
Here is the code that worked in your pen:
html - added bg div:
<div class="bg"></div> <div class="blend"></div> <img src="http://lorempixel.com/500/500/">
it css:
.bg{ background: #000; position: absolute; width: 100%; height: 100%; margin: 0; } body { background: #000; width: 100%; height: 100%; margin: 0; }
I also changed the body to fill the window so that the margin is not yellow either. Alternatively, div divs can be sized to fit the body.
tagging @chrscblls since they wanted to know if you found anything.
EDIT:
For another codef, the problem was not the same. They tried to darken the image and the yellow rectangle on a gray background.
If they did not want the yellow color to appear on their gray background, the solution was to simply put the image inside the div and use :: after to mix the color. Or even just create an empty div, give it an image as a background and use :: after.
<div/>
from:
body { background: #333; } div{ position:fixed; width: 500px; height: 500px; top:50px; left: 50px; mix-blend-mode: darken; background-image: url("http://lorempixel.com/500/500/"); } div::after { content: ""; height: 100%; width: 100%; background-color: yellow; mix-blend-mode: darken; position:absolute; opacity: 1; left: 0; top: 0; }
or that:
<div><img src="http://lorempixel.com/500/500/"></div>
without a "background image" in a css div.