简体   繁体   English

混合混合模式粘性 position

[英]mix-blend-mode sticky position

I'm trying to get my Hello World to be affected by the red background color as it slides behind, how can this be achieved, if possible at all?我试图让我的 Hello World 在滑到后面时受到红色背景颜色的影响,如果可能的话,如何实现? The text should change color as the below element slide behind the text当下面的元素在文本后面滑动时,文本应该会改变颜色

 body { height: 150vh; background: #000; } h1 { mix-blend-mode: difference; color: rgb(255, 255, 255); z-index: 2; }.top { position: sticky; top: 0; height: 50vh; z-index: 1; }.bottom { background: rgb(232, 12, 12); position: sticky; top: 0; height: 50vh; position: relative; isolation: isolate; }
 <div> <div class="top"> <h1>Hello World</h1> </div> <div class="bottom"></div> </div>

for the mix-blend-mode to work apply it like this为了使混合模式正常工作,像这样应用它

 body { height: 150vh; background: #000; } h1 { color: rgb(255, 255, 255); z-index: 2; }.top { mix-blend-mode: difference; position: sticky; top: 0; height: 50vh; z-index: 1; }.bottom { background: rgb(232, 12, 12); position: sticky; top: 0; height: 50vh; position: relative; isolation: isolate; }
 <div> <div class="top"> <h1>Hello World</h1> </div> <div class="bottom"></div> </div>

some one in your comment section also said the same thing - Dai你评论区的一些人也说了同样的话——戴

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM