html - 背景图像在移动设备中不合适 - CSS
问题描述
我正在设计一个网页,它有一个固定的背景图像,我在移动视图中遇到了问题。就像,在桌面视图中,它完全没问题。然而,在移动视图中,图像太模糊并且不好看。我找不到我犯错的地方。我在这里附上了视图的图像和我的背景图像代码。
桌面:
移动的:
我的 CSS:
body
{
font: 400 15px Lato, sans-serif;
line-height: 1.8;
color: #ffffff ;
background-image: url(images/cover3.jpg);
background-repeat: no-repeat;
background-attachment: fixed;
}
解决方案
用这个
html {
background: url(images/bg.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
body{
background: none;
}
这个填充适合屏幕大小的背景
推荐阅读
- mongodb - mongodump 转储所有但排除特定集合
- google-sheets - 在 Google 表格上的公式方格中留空
- awk - 否则,如果条件不适用于 awk
- php - Bootstrap Modal - 为每个循环更新 php 中的模式 id
- css - 高度为 100% 的可滚动固定 Div
- r - 在 Rmarkdown 中编织后的额外空白区域
- c++ - 在 Qtableview 列中添加组合框
- javascript - javascript代码来改变点击更多按钮的背景颜色
- rust - 在pest.rs、pesticast crate 中,我如何派生一个枚举字段?
- pytorch - 一些批次后的 Pytorch 推断 OOM