[英]css repeat background vertically
I can't seem to figure out how to vertically repeat a background image on a <div>
here's my code. 我似乎无法弄清楚如何在<div>
上垂直重复背景图像,这是我的代码。
http://jsfiddle.net/pedenski/Sw6wB/ http://jsfiddle.net/pedenski/Sw6wB/
what im trying to accomplish here is to put a shadow effect on the side of the page. 我要在这里完成的工作是在页面的侧面放置阴影效果。 similar with the http://www.adobe.com/ website. 与http://www.adobe.com/网站类似。 you'd see a shadow border on both sides. 您会在两侧看到阴影边框。
You just have no height for your left and right divs. 您的左div和右div都没有高度。
See this updated JS fiddle. 请参阅此更新的JS小提琴。
I've added height:100px;
我添加了height:100px;
just to show that it works 只是为了证明它有效
div#right {
background-image:url(http://i45.tinypic.com/ejv8uq.png);
background-repeat: repeat-y;
width:100px;
height:100px;
float:right;
}
and here is a fix for left block( background-position:top right;
and height): 这是修复左块的问题( background-position:top right;
and height):
div#left {
background-image:url(http://i47.tinypic.com/2hsc187.png);
width:100px;
height:100px;
float:left;
background-repeat: repeat-y;
background-position:top right;
}
Use background:url(http://i47.tinypic.com/2hsc187.png) right top repeat-y;
使用background:url(http://i47.tinypic.com/2hsc187.png) right top repeat-y;
here is the demo http://jsfiddle.net/Sw6wB/13/ 这是演示http://jsfiddle.net/Sw6wB/13/
Depending on this tag, the image might repeat in horizontal or vertical or both directions. 取决于该标签,图像可能会在水平或垂直方向或两个方向上重复。
It takes any of the following values: 它采用以下任一值:
repeat
: This value tells the image to be repeated in both directions repeat
:此值告诉图像在两个方向上重复
repeat-x
: This value tells the image to be repeated in vertical direction only repeat-x
:此值告诉图像仅在垂直方向上重复
repeat-y
: This value tells the image to be repeated in horizontal directions repeat-y
:此值指示图像在水平方向上重复
no-repeat
: This value tells that the background image should not be repeated no-repeat
:此值表明背景图像不应重复
For example: repeat-x
will work for repeating a vertical background. 例如: repeat-x
将适用于重复垂直背景。
采用:
background-repeat: repeat-y;
To repeat background vertically you can use background-repeat: repeat-y;
要垂直重复背景,可以使用background-repeat: repeat-y;
But your CSS is not good to display that in fiddle. 但是您的CSS不能很好地显示出来。
I 'll suggest to use box-shadow for such things. 我建议将box-shadow用于此类情况。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.