提问者:小点点

如何在div上创建响应背景


我试图在div元素上制作响应性背景图像,但它不工作。

下面是我的CSS:

.block-main{
  background: url(images/ohdaihiep/bg1.png) center center/cover no-repeat;
  min-height:863px;
}

共1个答案

匿名用户

您可以使用vhvw使其响应:

摆弄来玩去。

null

.block-main {
  background: url(http://placekitten.com/301/301)center center/cover no-repeat;
  height: 100vh;
  width: 100vw;
}
<div class="block-main">

</div>