首页 > 解决方案 > 背景图像不收缩,具体取决于移动屏幕中的设备

问题描述

我很难以所需的方式显示背景图像。在台式机版本上,即使我可以使用最小的分辨率-图像在内部是收缩的,但是当我在手机上尝试时-它不起作用。

padding: 0;
margin: 0;
width: 100%;
height: 100%;
background: url("../img/background_photo.png") center fixed;
background-repeat:no-repeat;
background-position: center center;
-webkit-background-size:cover;
-moz-background-size:cover;
-o-background-size:cover;
background-size: cover;

这是背景图像的代码。无论宽度或高度是多少 - 它都会收缩,所以看起来不错,但在移动设备上 - 它不起作用。

我认为问题一定是,因为我没有在媒体查询中包含代码,但是当我添加它时 - 它不再起作用了。

标签: javascripthtmlcssresponsive-design

解决方案


推荐阅读