CSS背景图像不会停留在原地



我的问题是:我的网页使用了三个背景图像,其中两个我可以使用"background position"属性正确定位,但当浏览器窗口扩大时,第三个图像(lady.png)将不会停留在我想要的页面上。她似乎是相对于浏览器的边缘定位的。我试过使用"背景附件:固定"将照片放在一个地方,但这不起作用。

我想要的是主要的顶部和底部图形对齐"顶部中心",女性的图像从左起约200像素,从顶部起约300像素。我已经试过"背景位置:200px 300px",但她仍然会随着框架移动。如有任何协助,我们将不胜感激。

以下是截至目前该页面的代码:http://dev.salonbuilder.com/website/150099/services.asp

<td width="100%" style="background-image:url(<%=ImagePath%>lady.png),url(<%=ImagePath%>new-bg-top.jpg),url(<%=ImagePath%>new-bg-line.jpg);background-repeat:no-repeat,no-repeat,repeat-y;background-position:80px 150px, top center,top center; background-attachment: fixed, relative, relative;">

谢谢!

这里有一个解决方案。由于你没有使用响应式设计,你可以为<table>标签指定一个固定的宽度,这将解决缩小网站时lady.png图像向左移动的问题。您可以将以下样式添加到样式表的底部:

table {
     width: 1349px;
}

或者像这样内联添加:

<table width="1349px" height="" border="0" cellpadding="0" cellspacing="0" align="center">...</table>

最新更新