html - 背景尺寸:Iphone 上的封面显示不清晰
问题描述
再会!这行 CSS 代码在其他浏览器中运行良好。但是每当我尝试使用 safari 运行代码时。图像显示不好。一些线程说解释说我必须对 iPhone 使用媒体查询:Iphone Media Query 下面的示例代码
@media (max-width: @iphone-screen) {
background-attachment: scroll;
}
但是该代码无法正常工作。谁能帮我解决这个问题?这是我的代码:
#video {
background: url("images/sample_8.jpg");
-webkit-background-size: cover;
background-size: cover;
background-repeat:no-repeat;
background-position: center;
background-attachment:fixed;
position: relative;
color: #999;
-webkit-filter: grayscale(100%);
filter: grayscale(100%);
}
解决方案
你可以试试background-size:contain;
iphone:
@media (max-width: @iphone-screen) {
background-size:contain;
}
推荐阅读
- php - 无法注册用户,试图在 null 上调用函数 _setnew()
- kotlin - Kotlin 中 Dagger 中带注释的绑定之间的依赖循环
- r - 在 R 中使用正则表达式来检测一类字符中的一个或两个重复字符
- flutter - 如何通过 Flutter 中的 Provider 通知嵌套子级的侦听器?
- c - 我们可以在while循环中左移一个值吗?
- assembly - 攻击实验室第一阶段分段故障
- javascript - 如何制作像 Kayak 中的下拉菜单?
- node.js - Passport.js Spotify 策略 - User.Save() 不是函数
- aws-glue - Glue 中是否有更新表格的选项?
- python - 为什么 PySpark 任务花费了太多时间?