gpt4 book ai didi

css - 混合混合模式差异

转载 作者:太空宇宙 更新时间:2023-11-04 07:54:36 24 4
gpt4 key购买 nike

我尝试添加 mix-blend-mode: difference;到“跨度”,但它不起作用。

此解决方案有效:我将混合模式而不是“.caption span”添加到“.caption”。但我真正需要的是将 span 放在一个 div 中。

有什么想法吗?谢谢!

.caption {
position: absolute;
top: 10px;
left: 10px;
z-index: 99;
font-size: 62px;
}

.caption span {
color: #fff;
mix-blend-mode: difference;
}

.background-image {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
pointer-events: none;
overflow: hidden;
z-index: 0;
}

.background-image img {
object-fit: cover;
width: 100%;
height: 100%;
position: absolute;
left: 0;
top: 0;
}
<div class="row">

<div class="row-inner">

<div class="caption">
<span class="test">Headline</span>
</div>

</div>

<div class="background-image">
<img src="https://www.smashingmagazine.com/wp-content/uploads/2015/06/10-dithering-opt.jpg">
</div>


</div>

最佳答案

据我所知,唯一的方法是使用 mix-blend-mode是通过放置 <span><img>在同一<div>

为您准备的工作样本。

span {
color: #fff;
mix-blend-mode: difference;
position: absolute;
top: 10px;
left: 10px;
z-index: 99;
font-size: 62px;
}

.background-image {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
pointer-events: none;
overflow: hidden;
z-index: 0;
}

.background-image img {
object-fit: cover;
width: 100%;
height: 100%;
position: absolute;
left: 0;
top: 0;
}
<div class="row">
<div class="background-image">
<span class="test">Headline</span>
<img src="https://www.smashingmagazine.com/wp-content/uploads/2015/06/10-dithering-opt.jpg">
</div>


</div>

另一种方法是设置 backgroundwrapper div 添加到图像中,它将起作用。

希望对您有所帮助。

可以与 mix-blend-mode 一起使用的值按照这个link

/* Keyword values */
mix-blend-mode: normal;
mix-blend-mode: multiply;
mix-blend-mode: screen;
mix-blend-mode: overlay;
mix-blend-mode: darken;
mix-blend-mode: lighten;
mix-blend-mode: color-dodge;
mix-blend-mode: color-burn;
mix-blend-mode: hard-light;
mix-blend-mode: soft-light;
mix-blend-mode: difference;
mix-blend-mode: exclusion;
mix-blend-mode: hue;
mix-blend-mode: saturation;
mix-blend-mode: color;
mix-blend-mode: luminosity;

/* Global values */
mix-blend-mode: initial;
mix-blend-mode: inherit;
mix-blend-mode: unset;

关于css - 混合混合模式差异,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47453392/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com