<分区>
<分区>
我已阅读上述问题,在 Firefox 中使用 CSS 过滤器在 position: absolute
上运行良好。但是 position: fixed
使用 CSS filter 仍然没有达到预期的效果。 position: fixed
在 Firefox 中使用 CSS 过滤器就像 position: absolute
一样,如下所示:
html {
-moz-filter: grayscale(100%);
filter: grayscale(100%);
height: 100%;
}
img{
position: fixed;
bottom: 10px;
right: 10px;
}
div {
margin-top: 10000px;
}
<img src="https://www.google.com/images/srpr/logo3w.png">
<div id="b">The end.</div>
谁能解决这个问题?
最佳答案
如果您不将 filter
应用于 html
并且仅将其应用于图像,则似乎有效。或者,如果您想将其应用于多个元素,请将它们包装在一个元素中并将过滤器/定位应用于包装器。
body {
min-height: 500vh;
}
img {
-moz-filter: grayscale(100%);
filter: grayscale(100%);
position: fixed;
bottom: 0;
right: 0;
}
<img src="https://www.google.com/images/srpr/logo3w.png">
关于html - 位置 : fixed works like position: absolute in Firefox when using CSS filter,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43853192/