CSS在背景图像完成后重复背景图像

时间:2014-10-10 11:50:00

标签: css background background-image repeat

我需要在我的网站上使用静态无重复背景图像,但是当图像完成(垂直)时,我需要重复使用另一张图像。怎么可以这样做?

对于第一张图片应该是这样的:

background:url(../img/header/main_bg01.jpg) no-repeat top center;

但对于第二个,在第一个之后垂直,应该像:

background:url(../img/header/main_bg02.jpg) repeat top center;
background-repeat: repeat-y;

怎么可以这样做?

此致

1 个答案:

答案 0 :(得分:2)

在同一元素上使用多个背景(根据需要调整大小):

background: 
   url(bg1.png) 500px 100px no-repeat,
   url(bg2.png) 50px 100px repeat;