首页 > 解决方案 > 响应式背景 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 的情况下工作?希望你明白我的意思谢谢

标签: htmlcssbackgroundfrontendresponsive

解决方案


尝试这个

.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;
}

推荐阅读