我正在尝试创建一个简单的视差图像,并固定背景。该图像在我的安卓手机中的安卓mozilla浏览器上看起来不错,在chrome开发人员的工具中也不错,但当我在IphoneX上查看时,图像看起来放大并固定了。这是我的密码。
HTML:
<div class="weddingparallax">
</div>
CSS:
.weddingparallax {
background-image: url("imageurl");
background-attachment: fixed;
background-size: cover;
background-position: center;
height: 80vh;
}
试试这个:
.weddingparallax {
background-image: url("imageurl");
min-height: 500px; /* you can change it */
background-attachment: fixed;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
请告诉我它是否有效!