小编Dre*_*rew的帖子

div全宽度的响应背景图像

我试图找出如何在div全宽和响应中制作背景图像.背景图像在页面宽度上扩展(并且响应),但图像的高度不是其全高.似乎它正以某种方式被切断.我正在使用bootstrap框架,我试图这样做的原因是我想在图像上叠加一些文本.我尝试了很多不同的东西,但似乎无法弄明白,帮助!

<div class="bg-image">
  <div class="container">
    <div class="row-fluid">
      <div class="span12">
        <h1>This is some text</h1>
      </div>
    </div>
  </div>
</div>


  .bg-image {
  background: url(img/image.jpg) no-repeat center top;
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
  max-height: 450px;
  }
Run Code Online (Sandbox Code Playgroud)

html css background-image responsive-design twitter-bootstrap

15
推荐指数
2
解决办法
10万
查看次数