引导,h1 覆盖在容器内的背景图像上


<div class="row text-center">
    <div class="col-md-12">
    <!--Giant Background Pic-->
    <img class ="bckground" src="images/napaliWall.jpg">
    <h1> Title Text </h1>
    <p> Sand sand sand sand</p>
    </div>
</div>

.bckground{
  background-size: cover;
  background: no-repeat;
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  max-height:100%;
  max-width:100%;
}

我的 h1 和 p 没有叠加在背景图像上。在引导程序的容器中执行此操作的正确方法是什么?我不想使文本成为固定位置,因为我担心它可能会扰乱我的移动网页的响应能力。我只是希望我的背景图像填充它所在的行列容器,并且必须在它上面发文本。我的 HTML 代码被包装在一个div 容器中,只是没有显示。

您应该在CSS中将图像设置为背景

喜欢背景网址:(网址到图像(

最新更新