在以下位置找到了此解决方案
在我看来,使用:before伪元素是一种聪明的方法。限制固定宽度元素的宽度,但对全角页面效果很好。本质上看起来像这样:
.background_fill { overflow: hidden; position: relative; color: red;}.background_fill:before { background-color: white; background: url('http://www.lausanneworldpulse.com/pdfs/brierley_map_0507.jpg') no-repeat center center; background-size: cover; z-index: -3; content: " "; position: fixed; will-change: transform; width: 100%; height: 100%;}<div > <div>this is on a background / this is on a background / this is on a background / this is on a background / this is on a background / this is on a background</div> <div>this is on a background / this is on a background / this is on a background / this is on a background / this is on a background / this is on a background</div> <div>this is on a background / this is on a background / this is on a background / this is on a background / this is on a background / this is on a background</div> <div>this is on a background / this is on a background / this is on a background / this is on a background / this is on a background / this is on a background</div> <div>this is on a background / this is on a background / this is on a background / this is on a background / this is on a background / this is on a background</div> <div>this is on a background / this is on a background / this is on a background / this is on a background / this is on a background / this is on a background</div> <div>this is on a background / this is on a background / this is on a background / this is on a background / this is on a background / this is on a background</div> <div>this is on a background / this is on a background / this is on a background / this is on a background / this is on a background / this is on a background</div> <div>this is on a background / this is on a background / this is on a background / this is on a background / this is on a background / this is on a background</div> <div>this is on a background / this is on a background / this is on a background / this is on a background / this is on a background / this is on a background</div> <div>this is on a background / this is on a background / this is on a background / this is on a background / this is on a background / this is on a background</div> <div>this is on a background / this is on a background / this is on a background / this is on a background / this is on a background / this is on a background</div> <div>this is on a background / this is on a background / this is on a background / this is on a background / this is on a background / this is on a background</div> <div>this is on a background / this is on a background / this is on a background / this is on a background / this is on a background / this is on a background</div> <div>this is on a background / this is on a background / this is on a background / this is on a background / this is on a background / this is on a background</div> <div>this is on a background / this is on a background / this is on a background / this is on a background / this is on a background / this is on a background</div></div>
作为解决这个非常烦人的bug的一种方式,对我来说非常有用。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)