下午好 试图在我着陆时做出响应式背景,但出于某种原因我不能 我试图使用 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 它从我的标题菜单中缩进,但是我有什么办法可以让它在没有计算的情况下工作吗? 希望你明白我的意思 谢谢
最佳答案
试试这个
.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;
}
关于html - 响应式背景 CSS 登陆,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55214470/