【问题标题】:Jumbotron background image is not synchronous with HTML background imageJumbotron 背景图片与 HTML 背景图片不同步
【发布时间】:2019-07-11 17:16:50
【问题描述】:

我想用背景图片覆盖我的页面,并且我正在使用一个覆盖页面所有组件但它的大小不覆盖所有页面的 jumbotron。因此,我还在我的 css 文件中的 .html 中附加了一个背景图片。

    .jumbotron {
  padding: 1rem 1rem;
  background-color: #e9ecef;
  height: 100%;
  background-size: cover;
  background-image: url('background.jpg');
}

html {
  font-family: sans-serif;
  line-height: 1.15;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  background-image: url('background.jpg');
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
}

现在,图像看起来像一面破碎的镜子。我怎样才能让它看起来像一个单一的图像?或者这样做的合乎逻辑的方式是什么?

【问题讨论】:

    标签: html css background


    【解决方案1】:

    你可以在body标签上应用背景图片。

    body {
          width:100%;
          background-image: url('background.jpg');
          background-position: center center;
          background-repeat: no-repeat;
          background-size: cover;
    }
    

    【讨论】:

      【解决方案2】:

      你可以试试这个,

      body {
        margin: 0;
        height: 100vh;
        background-image: url(background.jpg);
        background-size: cover;
        background-position: center;
      }
      

      【讨论】:

      • 但是背景已经完成,但是jumbotron背景没有设置为图像,看起来是白色的。
      • 能否提供一个sn-p,以便我检查
      • 对不起,当我改变 jumbotron 的不透明度时,这有效
      猜你喜欢
      • 1970-01-01
      • 2016-10-16
      • 1970-01-01
      • 2014-01-21
      • 1970-01-01
      • 1970-01-01
      • 2010-09-25
      • 1970-01-01
      相关资源
      最近更新 更多