折叠时垂直堆叠的自举柱

时间:2019-05-24 10:56:01

标签: twitter-bootstrap collapse

我有一个非常简单的引导程序布局,最近我添加了一个按钮来显示其中包含一些列的折叠行。

折叠/显示效果很好,但是行内的这两列像行一样垂直堆叠,我不知道为什么。

当我移除折叠材料时,它们会按照预期的方式并排放置。

有人知道如何解决吗?

<div class="row">
  <div class="col-lg my-3">
    <a class="collapse-div" href="#collapseRow" data-toggle="collapse" aria-expanded="false" aria-controls="collapseRow">
      SHOW
    </a>
  </div>
</div>

<div class="row collapse" id="collapseRow">
  <div class="col-lg-2">
    <div class="row">
      <div class="col-lg">
        TEXT
      </div>
    </div>
    <div class="row">
      TEXT
    </div>
    <div class="row font-14 p-1">
      TEXT
    </div>
    <div class="row font-14 p-1">
      TEXT
    </div>
    <div class="row font-14 p-1">
      TEXT
    </div>
  </div>

  <div class="col-lg-2">
    <div class="row">
      <div class="col-lg">
        TEXT
      </div>
    </div>
    <div class="row">
      TEXT
    </div>
    <div class="row font-14 p-1">
      TEXT
    </div>
    <div class="row font-14 p-1">
      TEXT
    </div>
    <div class="row font-14 p-1">
      TEXT
    </div>
  </div>
</div>

1 个答案:

答案 0 :(得分:0)

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>

<div class="row">
  <div class="col-lg my-3">
    <a class="collapse-div" href="#collapseRow" data-toggle="collapse" aria-expanded="false" aria-controls="collapseRow">
      SHOW
    </a>
  </div>
</div>

<div class="row collapse" id="collapseRow">
  <div class="col-lg-2">
    <div class="row">
      <div class="col-lg">
        TEXT
      </div>
    </div>
    <div class="row">
      TEXT
    </div>
    <div class="row font-14 p-1">
      TEXT
    </div>
    <div class="row font-14 p-1">
      TEXT
    </div>
    <div class="row font-14 p-1">
      TEXT
    </div>
  </div>

  <div class="col-lg-2">
    <div class="row">
      <div class="col-lg">
        TEXT
      </div>
    </div>
    <div class="row">
      TEXT
    </div>
    <div class="row font-14 p-1">
      TEXT
    </div>
    <div class="row font-14 p-1">
      TEXT
    </div>
    <div class="row font-14 p-1">
      TEXT
    </div>
  </div>
</div>