javascript - 背景图像不收缩,具体取决于移动屏幕中的设备
问题描述
我很难以所需的方式显示背景图像。在台式机版本上,即使我可以使用最小的分辨率-图像在内部是收缩的,但是当我在手机上尝试时-它不起作用。
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;
这是背景图像的代码。无论宽度或高度是多少 - 它都会收缩,所以看起来不错,但在移动设备上 - 它不起作用。
我认为问题一定是,因为我没有在媒体查询中包含代码,但是当我添加它时 - 它不再起作用了。
解决方案
推荐阅读
- php - PHP / Laravel - 验证来自传入邮件的文件类型
- docker - 我可以在 CI 环境中使用 gcloud app deploy 吗?
- javascript - 引导表显示条目不显示单元格的确切数量
- go - 是否可以只记录收到的每个信号而不改变行为?
- sql-server - SSRS 中的计数值
- github - 将 GitHub 存储库移动到另一个存储库时出错
- python - 安装 Jupyter Notebook NumPy 和 TensorFlow 后无法正常工作
- laravel - 在 laravel 中插入和更新 3 个表中的记录
- python - 在python中读取特殊格式的文本文件
- angular - 如何对 authguard 的 Angular 的 canActivate 进行单元测试?