gpt4 book ai didi

html - 如何让我的背景在一个固定的位置?

转载 作者:行者123 更新时间:2023-11-28 01:31:27 26 4
gpt4 key购买 nike

我使用 ionic 3。我的背景在移动,我不想让它滚动。如何让我的背景位置固定?

<style>
#back {
background-size: 100%;
background-repeat: no-repeat!important;
background-size: cover!important;
width: 105vw!important;
height: 100vh!important;
margin-left: -10%!important;
background-attachment: fixed!important;
margin-top: -10%!important;
background-position: center center!important;
}
</style>
          #back {
background-size: 100%;
background-repeat: no-repeat;
background-size: cover;
width: 105vw;
height: 105vh;
margin-left: -10%;
background-attachment: fixed;
margin-top: -10%;
background-position: center center;
}

.ion-content {
background: url('../assets/imgs/back.png');
}

最佳答案

您可以使用 position 属性。

<style>
#back {
background-size: 100%;
background-repeat: no-repeat!important;
background-size: cover!important;
width: 105vw!important;
height: 100vh!important;
margin-left: -10%!important;
background-attachment: fixed!important;
margin-top: -10%!important;
background-position: center center!important;
position: fixed;
}
</style>

关于html - 如何让我的背景在一个固定的位置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50933069/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com