【问题标题】:CSS repeat a background image after a background image finishesCSS在背景图像完成后重复背景图像
【发布时间】:2014-10-10 11:49:59
【问题描述】:

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

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

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;

这是怎么做到的?

问候,

【问题讨论】:

    标签: css background background-image repeat


    【解决方案1】:

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

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

    【讨论】:

    • 很好的解决方案但是IE8不支持多背景