CSS背景图片在真正的智能手机上的浏览器中没有响应

问题描述 投票:0回答:3

我有如下所示的CSS,在PC浏览器中进行响应时,我已经使用响应式设计模式对其进行了正常测试,但是当我在手机上进行测试时,背景没有响应:

.imgBG {
  background: url(../../../assets/img/bg-img/bg-login-blur.jpg) no-repeat center center fixed;
  font-family: Open Sans;
  padding-top: 40px;
  padding-bottom: 40px;
  position: fixed;
  width:100%;
  height:100%;
  background-size:cover;
  background-position:center;
  background-repeat:no-repeat;
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  padding:20px;
 }

enter image description here

我想念的是什么,您能告诉我吗?

html css image background responsive
3个回答
0
投票

将此行添加到代码中background-attachment: fixed;


0
投票

使用此代码。

 .imgBG { 
    background-image: url(../../../assets/img/bg-img/bg-login-blur.jpg);
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
    width: 100%;
    height: 100%;
}

0
投票

将其添加到您的HTML标头中:

<meta name="viewport" content="width=device-width, initial-scale=1.0">
© www.soinside.com 2019 - 2024. All rights reserved.