我知道我可以在y方向上重复单个背景图像。但我想重复其中的一些。我也想调整它们的大小,以便它们每个都填满整个屏幕。即发挥它们彼此叠加的作用。

我知道我可以使用像整页这样的东西,但我宁愿自己编写代码。

我所拥有的是:

body {
       background: url("images/bg1.png");
       background-size: cover
}

最佳答案

这是一个丑陋的示例,但是它显示了许多不同的选项:

body {
  background-image   : url(http://lorempixel.com/400/200/),
                       url(http://lorempixel.com/400/200/sports/),
                       url(http://lorempixel.com/400/200/sports/1/);

  background-repeat  : repeat-y,
                       repeat-x,
                       repeat-y;

  background-position: bottom right,
                       top left,
                       bottom left;
}


https://jsfiddle.net/DIRTY_SMITH/c7Lof03h/2/

09-12 08:13
查看更多