我正在建设一个网站,我想在那里的背景图像被附加固定。我已经用下面的CSS在桌面浏览器中实现了这一点,但它在智能手机上不起作用。这是一个已知的bug -attachment: fixed。我不知道该怎么解决它。
#page-header{
height: 300px;
background: url("../img/wood.jpg");
background-attachment: fixed;
color: #fff;
border-bottom: 1px #eee solid;
padding-top: 50px;
}我的HTML
<header id="page-header">
<div class="container">
<div class="row">
<div class="col-md-6 offset-md-3 text-center">
<h1 id="h1header">Products</h1>
<p>Local, Organic, Tasty</p>
</div>
</div>
</div>
</header>你可以在http://maisonbergeret.com/product.html上找到我的网站
我的问题是如何才能保持完全相同的效果。
发布于 2017-09-10 14:25:36
这是我为页眉所做的更改。
#page-header:before{
content: "";
width: 100%;
height: 300px;
position: fixed;
background: url("../img/wood.jpg")no-repeat center center;
color: #fff;
border-bottom: 1px #eee solid;
padding-top: 50px;
z-index: -10;
display: block;
left: 0;
top: 0;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}在标题下面,我有一个带有id="products“的部分产品
section#products{
background-color: #FAEBD7;
}和我的身体背景颜色一样的颜色:#FAEBD7;
调整了边距,现在它起作用了。
https://stackoverflow.com/questions/46137362
复制相似问题