javascript - 高度为 100% 的主体,背景图像为 : cover to fill enire page not just a viewport - without js if possible

标签 javascript jquery html css

enter image description here

是否可以让背景图像覆盖整个页面,即使视口(viewport)小于页面,仅使用 css?

顺便说一句,我必须将 html,body 设置为 100% 高度。

最佳答案

尝试使用100vh 高度和背景尺寸:cover;它将覆盖整页这将起作用

关于javascript - 高度为 100% 的主体,背景图像为 : cover to fill enire page not just a viewport - without js if possible,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43154649/

相关文章:

html - 仅使用 CSS 切换 Accordion 字形图标

javascript - JavaScript 是否有像 "range()"这样的方法来生成提供的范围内的范围?

javascript - getJSON 只响应明文,否则不起作用?

javascript - 选择框应超出对话框的边缘

jquery - 如何使用 Devise 和 activerecord-reputation-system 获取 current_user 进行 Ajax 投票

javascript - 在 Canvas 上拖放 HTML5

javascript - 如何排列(每行)文本区域

javascript - Karma/Jasmine/Angular-Mocks "not a function got string"

javascript - 具有空数组的 JSON 对象 - Javascript

JQuery 自动完成 : how to force selection from list (keyboard)