在DIV内重复图像,然后是另一个图像

时间:2013-04-29 20:03:19

标签: javascript jquery html css

只是想提前感谢。

首先,我有一个Height: 100%Width: 130px的div我有一个130x5px的图像,我想垂直重复,直到达到屏幕高度的75%。然后我想在它下面直接放置另一个图像。我知道如何垂直重复图像。但我不知道如何在其下方附加另一张图像。

P.S。我希望它都在同一个div中,这样我就可以使用JQuery来控制div,而不仅仅是它内部的各个元素。

1 个答案:

答案 0 :(得分:3)

这样的事情怎么样:

div.snocavotia {
  background: url(http://lorempixel.com/130/5/) repeat;  
  z-index: 100; 
  height: 100%;
  width: 130px;
  position: relative;
}

div.snocavotia:after {
  background: url(http://lorempixel.com/130/30/) repeat;
  z-index: 1;
  content: '';
  position: absolute;
  top: 75%;
  right: 0;
  bottom: 0;
  left: 0;
}

示例:http://cssdesk.com/h2XGc

相关问题