【发布时间】:2014-06-27 17:02:32
【问题描述】:
好的,所以我正在尝试设置我的背景图片设置
所以它就像
左边的图片和右边的图片不一样。
我试过用这个
body{
background:
url(../Img/Background-01.png) center top no-repeat,
url(../Img/Background-02.png) right 0 repeat-x,
url(../Img/Background-03.png) left 0 repeat-x;
background-color:#232323;
}
但是 Background-02.png 与 Background-03.png 重叠,导致 Background-02.png 在页面的左侧和右侧重复,而它只意味着在右侧重复。
这是我设计的屏幕截图,它可能会让您更好地了解我正在尝试制作的内容 白框是背景层的一部分,它们在自己的图像中被裁剪出来,以便在网站上使用 [img]http://s7.postimg.org/iy0tm6k2j/Screen_Shot_2014_06_27_at_5_16_13_pm.png[/img]
任何帮助都会帮助解决这个问题。
好的,我知道这就是我使用的
'#Container{
position:relative;
width:1000px;
margin: 0 auto;
left: 0;
right: 0;
border:thin solid #000;
z-index:4;
}
#BGCont
{
position:absolute;
left:0;
right:0;
margin-left:auto;
margin-right:auto;
width: 100%;
z-index:0;
height:500px;
}
#BGLeft
{
position:absolute;
width: 50%;
left: 0;
z-index:1;
background:url(../Img/Background-03.png) left 0 repeat-x;
height:500px;
}
#BGRight
{
position:absolute;
width: 50%;
z-index:2;
right: 0;
background:url(../Img/Background-02.png) right 0 repeat-x;
height:500px;
}
#BGCenter
{
position:absolute;
left:0;
right:0;
margin-left:auto;
margin-right:auto;
width: 1200px;
z-index:3;
background:url(../Img/Background-01.png) center top no-repeat;
height:500px;
}'
现在我的问题是,这是一种可以接受的方式还是太混乱了?
【问题讨论】:
-
这里有一个解决方法jsfiddle.net/UwZ3V,它需要支持
calc()功能(IE9+),有时不使用这样有用的功能,我们不能有一些优雅的解决方案. -
好的,我解决了这就是我用的
-
看来你自己解决了,最好自己添加答案并接受。
标签: css background repeat