【发布时间】:2014-03-25 10:57:40
【问题描述】:
我有一个背景图片,当我将它写在我的身体标签中时,背景图片可以工作,但它与我身体上的文字重叠。我想将它放在身体后面,我尝试使用background-position,但它不起作用。如何将背景图像放在主体后面,使其不重叠?
body {
font-family: Arial, Helvetica, sans-serif;
font-size: 87.5%;
width: 800px;
background-color: #ffffff;
border-color: #000000;
box-shadow: #000000;
background: url(../images/bats.gif) center;
background-position: bottom;
text-align: center;
margin: 1em auto;
border: 5px black;
box-shadow: 3px 3px 3px 3px;
}
【问题讨论】:
-
我们可以看看一些代码吗?
-
“当我把它写在我的 body 标签中时,背景图片可以工作,但它会覆盖我身上的文字”——那你一定搞砸了——这不正常背景图像的行为(顾名思义,它是在背景中)。你的大部分内容可能是绝对定位的还是什么? “我想将它定位在身体后面,我尝试使用 background-position,但它不起作用” - 当然不是,因为
background-position用于在 x 轴和 y 轴上定位,而不是在 z 轴上。
标签: html image css background