背景图像不重复绝对元素

时间:2017-06-10 17:31:27

标签: html css

背景图像(地形)不重复。它停在上方  " Terra管理技术" (看图)。我想覆盖整个元素(手风琴),这是元素正上方的元素。

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;
}

3 个答案:

答案 0 :(得分:1)

您应该将图像用作背景图像,而不是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;
}

答案 1 :(得分:1)

您无法为{tag}做In [38]: pattern = re.compile(r"a+") In [39]: mat = pattern.search(s) In [41]: print(mat.group()) aaaa

代替background-repeat使用CSS使用<img>加载图片或使用background-image合并所有背景属性

background

答案 2 :(得分:1)

删除html中的图像并在CSS文件中设置background-image属性。

像这样:

&#13;
&#13;
.topography {
  background-image: url("https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcS1EwO-OcUp2ZTpjubUsiZPLm8RAej4XQLnKs5s3Ry5kAd8IEVT");
  /*relative link (from your css file location) to your background image*/
  background-repeat: repeat;
}
&#13;
<div class="topography">
  <p>What ever here is</p>
  <p>What ever here is 2</p>
  <p>What ever here is 3</p>
</div>
&#13;
&#13;
&#13;