【发布时间】:2019-11-19 13:22:21
【问题描述】:
我有一个背景图片集。当我在移动设备上查看时,背景图像在不同页面上的大小不同,即使它们都使用此代码链接到同一个样式表
网站是“treyscode.com”,您可以转到不同的页面并查看大小差异。页面还没有完成所以不要给我太多时间:)
'''
body {
background: url(../image/blackhole.jpg);
background-repeat: no-repeat;
background-position: center;
background-attachment: fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
height:100%;
width:100%;
}
'''
为什么不同的页面会以不同的尺寸显示背景图片?
【问题讨论】:
-
尝试在不同的系统和不同的浏览器上打开该网站
-
同样的事情。它是主页,它比其他页面大得多。其他的仍然是不同的大小,但主页是最激烈的
-
background-size:cover是这样工作的
标签: css mobile bootstrap-4 background-image