html - 响应式背景 CSS 着陆
问题描述
下午好尝试在我的着陆时制作响应式背景,但由于某种原因我不能尝试使用 height: auto, height: 100% 和 margin: 0 auto; 高度 100% 有效,但它没有覆盖到我的屏幕下方,我拥有它超过了我的需要。这是我的代码:
.crossfade > figure {
animation: imageAnimation 48s linear infinite 0s;
backface-visibility: hidden;
background-size: cover;
background-position: center center;
height: 470px;
left: 0px;
opacity: 0;
position: absolute;
top: 189px;
width: 100%;
background-color: rgba(0,0,0,.3);
background-blend-mode: darken;
z-index: 0;
}
唯一对我有用的是:
height: calc(100vh - 189px);
189px 它从我的标题菜单中缩进,但是我有什么办法可以让它在没有 calc 的情况下工作?希望你明白我的意思谢谢
解决方案
尝试这个
.crossfade > figure {
animation: imageAnimation 48s linear infinite 0s;
background-size: cover;
background-position: center center;
width: 100%;
height: 100vh;
position: absolute;
top: 0;
left:0;
right:0;
bottom:0;
background-color: rgba(0,0,0,.3);
z-index: 0;
}
推荐阅读
- asp.net-core - 使用 oauth2 进行身份验证,使用 Identity 进行授权
- c# - 在 Windows Mobile C# 中拨打 USSD 字符串
- pa11y - pa11y-ci 找不到 HTML 元素
- javascript - AngularJS表单-输入输入后ng-model变得未定义?
- asp.net-mvc - 从来自数据库的下拉列表中删除项目时遇到问题。使用 MVC
- html - Angular - 最简单的方法添加事件所有“p”,“span”,“h1”元素
- java - 将按钮绑定到多个属性不起作用
- php - 无法在函数类中调用全局变量
- python - 日志没有写入文件
- c# - 如何查询大型数据表而不在 MVC 应用程序中遇到错误?