How to hack unsupported mix-blend-mode CSS property?
If you don't want to use plain opacity as a fallback:
Approaches to cross-browser support
Javascript polyfill
This will be slow, and will not allow you to easily animate. However, it will let you create an alternate image for each of your matching images, and you can then fade the opacity or do other CSS transition tricks between the two.
http://codepen.io/brav0/pen/bJDxt (not my pen - uses multiply, not soft light)
Server side processing
Wouldn't be my first choice, but if you control the server-side code, you can prepare alternate images using server side imaging libraries (GD, etc)
Only enabling the effect for supporting browsers
Css hacks for detecting IE
@media screen { @media (min-width: 0px) {
div.img::after{ ... }
} }
Using JavaScript
if (window.getComputedStyle(document.body).mixBlendMode !== undefined)
$("div.img").addClass("curtain");
...and the CSS...
img.curtain::after { ... }
Elements set with mix-blend-mode break other element with mix-blend-mode property (Chrome)
The problem was caused by the fact that I had an empty <div>
as the first element inside my <body></body>
acting as a background that had a z-index
property of a negative number, or at least a non-zero value perhaps. Once I set the z-index
of my background <div>
to 0
or removed the z-index
property entirely then the mix-blend-mode
on the h1
problem stopped occurring for good.
HTML:
<body>
<div id="bg"></div>
...
...
</body>
Problem CSS:
#bg {
background-image: url("../img/someImage.jpg");
width: 100vw;
height: 100vh;
position: fixed;
background-repeat: no-repeat;
background-position: center;
background-size: cover;
z-index: -10;
}
I do not understand why this solved the problem as I figured out the solution by accident.
Firefox mix-blend-mode bug
I know this is an older question, but I ran into it and found the solution. Add this CSS to the element with the blend mode.
transform: translateZ(0);
Related Topics
Scale an Image to Maximally Fit Available Space and Center It
Removing Black Borders on a Vimeo Iframe Embed Using CSS
Putting Emoticons in Paragraphs Without Affecting 'Line-Height'
Inline CSS Background-Size Cover
Div Side by Side Without Float
Do We Need Type="Text/CSS" for <Link> in HTML5
Center an Image in a Div Too Small for It
Transform Scale Property Not Working in Chrome & Safari
Wrap Text Around an Image on Bootstrap 3
ASP.NET MVC 4 Minification & Background Images
How to Animate Infinite Marker Movement Down an Svg Path Without Very High CPU Usage
Less: Can You Group a CSS Selector with a Media Query
CSS - Position Absolute & Document Flow