【发布时间】:2020-10-20 21:28:49
【问题描述】:
.bg-image {
background-repeat: no-repeat;
background-attachment: fixed;
background-size: cover;
background-position: center center;
}
这是我用来为 div 设置背景图像的 CSS 代码。我面临的问题是图像高度在达到特定的屏幕宽度(设备尺寸)时会自动被裁剪。我该如何解决这个问题?
【问题讨论】:
-
没有设置
background-image属性。请包括minimal reproducible example,除了 CSS 之外还包含 HTML。您可以使用来自占位符或虚拟图像服务的图像。您可以使用Stack Snippets(工具栏中的图标类似于<>)。 -
我在 html 上设置 background-image 如下请edit您的问题包括minimal reproducible example。
标签: html css css-selectors