CSS fixed 定位元素失效的问题
一个示例考察下面的代码: <head> <title>css filter issue</title> <style> body { height: 200vh; background: #ddd; } .container { background: grey; height: 200px; } .fixed { color: red; position: fixed; top: 0; right: 0; } </style> </head> <body> <div class="container"> <div class="fixed">fixed item</div> </div> </body> 页面中有一个位于右上角 正常的 fixed 元素其表现 现在对容器加应用 CSS .container {
+ filter: invert(1);
background: grey;
height: 200px;
} 再观察结果,注意到 fixed 元素不再生效 原因根据 W3C 对
对于指定了 相同的情况对
解决这里只看 将 |