2背景拉伸1背景

时间:2013-09-23 00:14:06

标签: css

有没有办法拉伸1个背景。如果你设置了2?

body{

background-image: url(../images/pattern.png), url(../images/2.jpg);
background-repeat: repeat, repeat;
}

拉伸不是第一张图像而是第二张图像(2.jpg)

enter image description here

图像需要100%拉伸

2 个答案:

答案 0 :(得分:1)

您可以执行以下操作

body {
    background-image: url(bg1.png), url(bg2.png);
    background-repeat: repeat-y, repeat;
}

bg1.png(包含一个'1')将重复下来 bg2.png(包含单个'2')将反复重复

enter image description here

答案 1 :(得分:0)

使用以下css,您可以重复第一张图像,只将第二张图像拉伸到100%

body {
    background-image: url(bg1.png), url(bg2.png);
    background-repeat: repeat-y, no-repeat;
    background-size: 29 29, 100% 100%;
}

enter image description here

与DOCTYPE结合似乎存在一些问题。以下CSS与DOCTYPE结合使用。

body{
    background-image: url('../images/pattern.png'), url('../images/2.jpg');
    background-repeat: repeat, no-repeat;
    background-size: 29px 29px, 100% 100%;
}

enter image description here