css - 如果手机屏幕是横向的,如何将背景图像保持在底部?
问题描述
我正在开发一个应该是移动响应的 Angular Web 应用程序。背景图像必须始终位于底部。除了横向的移动设备外,我使所有尺寸都可以做到这一点。
我尝试在 Stack Overflow 中研究样本。我试过这个,但它只适用于其他很棒的设备,但不适用于我遇到的横向问题。
:host {
display: block;
position: absolute;
height: 100%;
background-image: url(../../../assets/images/...);
background-position: center bottom;
background-attachment: fixed;
background-repeat: no-repeat;
}
发生的情况是,就视口的高度而言,背景图像仅位于底部。它应该在页面的底部,包括页面的滚动高度(因为视图是横向的)。
解决方案
您是否尝试过使用背景图片定位 body 标签?
body {
background-image: url(../../../assets/images/...);
background-position: center bottom;
background-attachment: fixed;
background-repeat: no-repeat;
}
推荐阅读
- python - 或者工具 cp_model 知道哪个约束失败了
- typescript - 更有用的打字稿字典类型:警告访问的项目可能未定义
- angular - 如何合并多个 Observable 响应
- python - 是否可以在 spaCy IOB 转换器生成的 JSON 中检索整个句子?
- google-analytics - 如何在我的 Google 网站上发布 Google Analytics 访问者地图?
- typescript - 打字稿上的 Socket.io 附加属性不存在
- python - 如何在 Python 3.+ 中将所有数据从 VirtualEnv 移动到 CondaEnv
- linux - 使用 sed 命令在 linux 中列出以特定字符开头的元素
- python - 如何从合并的数据框中过滤记录
- excel - Excel VBA - 如果区域中的单元格具有相同的值,则删除整行