I'm trying to use mix-blend-mode: difference
on text as in this codepen:
if('CSS' in window && 'supports' in window.CSS) {
var support = window.CSS.supports('mix-blend-mode','difference');
// tests for mix-blend-mode support
support = support?'mix-blend-mode':'no-mix-blend-mode';
document.documentElement.className += support;
}
@import url(https://fonts.googleapis.com/css?family=Montserrat:700);
body {
text-align: center;
font-family: Montserrat, sans-serif;
color: #000;
margin: 0;
margin-top: 3rem;
}
.mix-blend-mode body {
/* only create background gradient if mix-blend-mode is supported; otherwise, default black text will remain ledgible against a plain white background */
background-image: linear-gradient(90deg,#fff 49.9%,#000 50%);
color: #fff;
}
h1 {
font-size: 10vw;
margin: 0;
mix-blend-mode: difference;
}
<h1>BAD BOY<h1>
And found out that it works at least on Firefox 72 and Safari 13 but not on Chrome 80.
Do you know what's wrong?
Thanks