#container{
background:url(images/bg-main.png) repeat-y;
width: 903px;
background-position: 0px 687px;
background-position: bottom;
height: 1200px;
margin-left: auto;
margin-right: auto;
}
#content{
background:url(images/bg-wood.png) repeat-y;
width: 903px;
height: 678px;
margin-left: auto;
margin-right: auto;
}
#content
div 在 #container
div 里面。我希望 #container
的背景从顶部开始重复 687 像素。可能吗?
编辑:是否有可能 div 的前 x 个像素(从顶部开始)有空白空间并且在 x 个像素背景开始后?
最佳答案
据我所知,你不可能尝试这样做,repeat-x 和 repeat-y 将沿轴的两个方向重复图像
如果你重复容器背景的全长,content div 的背景图片不会覆盖前 678px 吗?
你能在 JSFiddle 中提供代码吗,这样我们就可以看到你想要达到的效果会有一种方法;)
关于css 从定义的位置开始重复背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5604663/