【发布时间】:2015-09-08 18:23:31
【问题描述】:
这就是我想要实现的目标。顶部框的背景图像跨越整个浏览器宽度,中间有 2 个内容框。我已经做到了,没问题。
然后我需要在下面再放 2 个盒子,再次居中,但每一半都需要一个不同的背景图像,该图像应该在中间相遇并流向各自的边缘。我正在使用引导程序,因为我希望这些堆叠在较小的屏幕上。我不知道这怎么可能。黑色边框代表容器。我可以将顶部位包裹在自己的容器中,这很好,但我不知道如何让底部位工作,而且我真的不想使用绝对定位,因为这将是一场噩梦响应元素的工作。
这是我目前所拥有的
HTML:
<div class="fluid-full">
<div class="container">
<div class="row">
<div class="col-md-6">
<div class="example">
<h1>Title</h1>
<p>This is a paragraph</p>
</div>
</div>
<div class="col-md-6">
<div class="example">
<h1>Title</h1>
<p>This is a paragraph</p>
</div>
</div>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-md-6 left-half">
<div class="example">
<h1>Title</h1>
<p>This is a paragraph</p>
</div>
</div>
<div class="col-md-6 right-half">
<div class="example">
<h1>Title</h1>
<p>This is a paragraph</p>
</div>
</div>
</div>
</div>
CSS:
.example{
height: 200px;
border: 1px;
background-color: rgba(0,0,0,0.8);
padding: 30px;
border: 1px solid white;
color: white;
}
.fluid-full{
padding: 40px 0;
background-image: url(http://lorempixel.com/1920/400);
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
.left-half{
border-left: 25% solid transparent;
background-image: url(http://lorempixel.com/g/1000/400);
background-position: right;
background-repeat: no-repeat;
background-size: cover;
}
查看此Bootply
我需要将顶部和底部的框对齐。
任何帮助表示赞赏。
【问题讨论】:
-
这不能仅使用 Bootstrap 类来实现。您必须创建自定义类。