html - 位置 : fixed works like position: absolute in Firefox when using CSS filter

标签 html css firefox

<分区>

我已阅读上述问题,在 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/

上一篇:jquery - 下拉菜单打开时选择选项的文本颜色可见吗?

下一篇:html - 扩展 Div CSS

相关文章:

css - Firefox 3.5.3 水平菜单下拉

javascript - 水平滑出菜单在 Firefox 中不起作用

Javascript Easing 在 Firefox 中不起作用

php - 在 HTML5 中拖放多个文件?

CSS垂直扩展元素并移动伪元素

javascript - 使用 javascript 添加图像后浏览器滚动条移动

css - SVG 图像 CSS3 动画

滚动后的 jQuery fadeOut 使屏幕跳转

javascript - 如何获取 tspan 元素的位置和宽度

javascript - 菜单上的事件监听器不工作并且 "The key "初始规模的控制台错误“未被识别和忽略。”