CSS屬性兼容寫法
阿新 • • 發佈:2019-01-14
-i mage css屬性 code window body 屬性 document win
一種是用js判斷兼容性
// JS if ("CSS" in window && "supports" in window.CSS) { var support = window.CSS.supports("mix-blend-mode","difference"); support = support?"mix-blend-mode":"no-mix-blend-mode"; document.documentElement.className += support; } // CSS h1 { color: #000; } .mix-blend-mode body { background-image: linear-gradient(90deg,#fff 49.9%,#000 50%); } .mix-blend-mode h1 { color: #fff; mix-blend-mode: difference; }
用CSS中的@supports
@supports (mix-blend-mode: difference) { body { background-image: linear-gradient(90deg,#fff 49.9%,#000 50%) } h1 { color: #fff; mix-blend-mode: difference; } }
CSS屬性兼容寫法