【问题标题】:Safari: mix-blend-mode luminosity not working correctlySafari:混合混合模式亮度无法正常工作
【发布时间】:2023-10-14 12:46:01
【问题描述】:

我有一个mix-blend-mode 用于我的一张图片,它可以在 Firefox 和 chrome 上完美运行,但不能在 safari 上运行。覆盖在我拥有的 CSS 滑块上,我发现 transform 弄乱了 mix-blend-mode 属性。如何避免转换干扰 css 样式。

我正在使用 Swiper Slider

我在下面放置了我的代码以及它的外观。最终结果应如下所示:

section {
  position: relative;
  will-change: opacity;
}

section::after {
  background-color: #3b5873;
  border: 33.325px solid #c4ae7e;
  content: '';
  display: block;
  height: calc(100% - 66.65px);
  position: absolute;
  top: 0;
  width: calc(100% - 66.65px);
}

.container {
  background-color: #fff;
  height: 100%;
  width: 100%;
  position: relative;
  mix-blend-mode: luminosity;
  z-index: 9;
}

.image-bg {
  background-size: cover;
  padding-top: 59.08%;
}
<section>
  <div class="container">
    <div class="image-bg" style="background-image:url('http://dev-thepaxton.pantheonsite.io/wp-content/themes/paxton-theme/dist/images/home/gallery_0.jpg')"></div>
   </div>
</section>

【问题讨论】:

  • 我的 FF 68 和 Safari 12.1.1 的结果完全相同
  • 是的,我只是说这就是我想要的想法。使用滑动器滑块,它会以某种方式断裂。 @凯多
  • 给我们这个。我们无法帮助修复没有损坏的东西......

标签: css transform mix-blend-mode


【解决方案1】:

很遗憾,Safari/WebKit SVG 元素不支持 mix-blend-mode

https://caniuse.com/#feat=mdn-css_properties_mix-blend-mode_svg

【讨论】: