可能是因为使用了绝对定位的伪元素,导致无法撑开父元素(即body)的高度,从而无法实现背景图片全覆盖。

可以尝试使用以下方法来解决这个问题:

  1. 将伪元素的位置改为fixed,使其相对于视口固定定位。

  2. 将伪元素的高度改为auto,使其自适应父元素的高度。

  3. 将伪元素的z-index值改为比页面其他元素的z-index值更高,以确保它在页面上方。

例如:

body::before { content: ""; position: fixed; top: 0; left: 0; width: 100%; height: auto; background-image: url('/backend/web/../../resources/image//雪舞☆九天.gif'); background-repeat: repeat; background-size: cover; filter: invert(100%); z-index: 9999; }

页面使用pjax随着页面向下滚动页面高度会发生变化bodybefore 伪元素你好强大! content ; position absolute; top 0; left 0; width 100; height 100; background-image urlbackendwebresourcesimage雪舞☆九天gif; background-repeat repeat; back

原文地址: https://www.cveoy.top/t/topic/cRm9 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录