【发布时间】:2017-01-24 23:54:17
【问题描述】:
我想创建一个全宽布局,左侧为蓝色半边,右侧为红色半边。
之后我想在布局内但在容器内添加文本。
这可能吗?
编辑:您可以看到,绿色容器的大小与蓝色和红色一半内的 col-6 不同。
* {
color: white;
}
.blue-half {
background: blue;
}
.red-half {
background: red;
}
.green {
background: green;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<div class="container green">
I am the normal container!
</div>
<div class="container-fluid">
<div class="row">
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6 blue-half">
<div class="container-fluid text-center">
<div class="row">
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
I am first half of the blue container!
</div>
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
I am second half of the blue container!
</div>
</div>
</div>
</div>
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6 red-half">
<div class="container-fluid text-center">
<div class="row">
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
I am first half of the red container!
</div>
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
I am second half of the blue container!
</div>
</div>
</div>
</div>
</div>
</div>
【问题讨论】:
-
这就是我正在阅读的内容:“我想要一个绿色容器占据前半部分,将后半部分分成两半(即四分之一),然后将那些半部分分成两半”。如果这不完全正确,那么也许创建所需布局的图像并将其用作示例?
-
类似这样的东西(蓝色部分“我们是谁”):stripe.com/about - 两个半列的背景应该是全宽的,内容应该与引导程序中的普通容器的宽度相同.
-
这就像使用
container替换container-fluid并在蓝色/红色一半内使用 col-*-12 一样简单。我会适当地更新我的回复
标签: css twitter-bootstrap twitter-bootstrap-3 grid bootstrap-4