如何使我的背景图像响应

时间:2016-04-04 16:23:59

标签: css webpage responsive

我在我的网页上工作。我现在面临几个问题:

  • 图片不适应浏览器窗口的大小,如果我使浏览器窗口变小,图像将显示为重复
  • 我想,每张照片都是整个显示器
  • 如何在滚动期间保持页脚和菜单可见?
  •  以下是Codepen

    的链接
    #intro{
      background-image: url("http://www.tricentis.com/wp-content/uploads/2015/10/photo-1435575653489-b0873ec954e2.jpg");
      padding-top: 30px;
      background-size: cover; 
      height: 100vh;
      background-size: 100%;
    }
    

    提前感谢您的帮助

    2 个答案:

    答案 0 :(得分:0)

    doesn't do any good to set background size to cover if you're going to set it to 100% a couple lines down. remove background-size:100% and it works fine.

    答案 1 :(得分:-1)

    You can set

    background-repeat: no-repeat;
    

    to make sure each image isn't shown more than once.