引导并排div,一个固定大小?

时间:2018-04-17 05:45:30

标签: twitter-bootstrap bootstrap-4

我使用Bootstrap 4并试图并排放置2个div。我知道下面的方法:

<div class="row">
    <div class="col-6">
    </div>
    <div class="col-6">
    </div>
</div>

但我需要第一个div固定宽度:140px;实现这一目标的最佳做法是什么?

1 个答案:

答案 0 :(得分:1)

以下是使用弹性框进行操作的示例。 (不使用引导程序)

&#13;
&#13;
.parent-div {
  display: flex;
}

.first-div {
  width: 140px;
  height: 100px;
  background: blue;
 }
 
 .second-div {
 height: 100px;
 width: 100%;
  background: green;
 }
&#13;
<div class="parent-div">
    <div class="first-div">
    </div>
    <div class="second-div">
    </div>
</div>
&#13;
&#13;
&#13;

如果要自定义自己的引导列宽度,请选中this post

相关问题