CSS开始从固定位置重复背景 [英] css start repeating background from defined position
本文介绍了CSS开始从固定位置重复背景的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
#container的{
背景:网址(图像/ BG-main.png)重复-Y;
宽度:903px;
背景位置:0像素687px;
背景位置:底部;
高度:1200像素;
保证金左:自动;
保证金右:自动;
}
#内容{
背景:网址(图像/ BG-wood.png)重复-Y;
宽度:903px;
高度:678px;
保证金左:自动;
保证金右:自动;
}
#内容
DIV是 #container的
DIV中。我想 #container的
的背景,开始在687px从上重复。这可能吗?
编辑:?难道DIV的第一x像素(从顶部)有emtpy空间和后backgrund开始x像素
解决方案
背景:网址(映像路径)0像素287px重复-Y;
这会从垂直从287px顶部重复你的背景图片。
但另一种方式是将它设置为你的内容的div:
的margin-top:287px;
您最好的解决办法是做这样的:
#container的{
位置:相对;
}
#背景{
背景:网址(图像URL');
位置:绝对的;
顶:287px;
左:0像素;
的z-index:100;
}#内容{
位置:绝对的;
顶:0像素;
左:0像素;
的z-index:99999;
}
#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 is inside #container
div. I want #container
's background to start repeating at 687px from top. Is it possible?
EDIT: Is it possible that first x pixels of div (from top) have emtpy space and after x pixels backgrund starts?
解决方案
background : url('image path') 0px 287px repeat-y;
This will repeat vertically your background image from 287px from top.
but another way is to set this to your content div :
margin-top:287px;
you best solution is to do like this :
#container{
position:relative;
}
#background{
background:url('image url');
position:absolute;
top:287px;
left:0px;
z-index:100;
}
#content{
position:absolute;
top:0px;
left:0px;
z-index:99999;
}
这篇关于CSS开始从固定位置重复背景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文