gpt4 book ai didi

html - 背景图像不在绝对元素上重复

转载 作者:太空宇宙 更新时间:2023-11-03 22:39:52 26 4
gpt4 key购买 nike

背景图像(地形)不重复。它停在 “土地管理技术”(看图片)。我想覆盖整个元素( Accordion ),也就是页脚正上方的元素。

webpage

HTML

<div class="accordion">
<span class"topography"><img src="/img/bg/topo.svg"/></span>
.....
</div>

CSS

.accordion {
position: relative;
}

.topography {
position: absolute;
top: 0;
bottom: 0;
right: 0;
left: 0;
pointer-events: none;
background-repeat: repeat;
}

.topography img{
height: 100%;
background-repeat: repeat;
}

最佳答案

那么您应该将图像用作背景图像,而不是 img 标签:

<div class="accordion">
<span class"topography"></span>
.....
</div>

CSS

.accordion {
position: relative;
}

.topography {
position: absolute;
top: 0;
bottom: 0;
right: 0;
left: 0;
pointer-events: none;
background-image: url("/img/bg/topo.svg");
background-repeat: repeat;
}

关于html - 背景图像不在绝对元素上重复,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44476143/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com