代码之家  ›  专栏  ›  技术社区  ›  mindlessgreen

侧面可折叠引导板

  •  1
  • mindlessgreen  · 技术社区  · 6 年前

    手风琴面板看起来像这样

    <p>
    <a class=“btn btn primary”data toggle=“collapse”href=“collapsexample”role=“button”aria expanded=“false”aria controls=“collapsexample”>
    与HREF链接
    & lt;/a & gt;
    & lt;/p & gt;
    <div class=“collapse”id=“collapse示例”>
    <DIV class=“卡片正文”>
    这是一些内容。
    &L/DIV & GT;
    &L/DIV & GT;
    < /代码> 
    
    

    内容显示在按钮下方。

    如何将折叠面板移动到按钮的右侧?如下图所示

    .

    enter image description here

    内容显示在按钮下方。

    如何将折叠面板移动到按钮的右侧?如下所示

    2 回复  |  直到 6 年前
        1
  •  0
  •   AG_    6 年前

    如果您正在使用 bootstrap 然后用适当的方法,用 rows cols . 这样,您也可以获得响应式布局。

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
    <link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet"/><script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.bundle.min.js"></script>
    <div class="row">
      <div class="col-auto">
        <a class="btn btn-primary btn-block" data-toggle="collapse" href="#collapseExample" role="button" aria-expanded="false" aria-controls="collapseExample">
          Link with href
        </a>
      </div>
      <div class="col">
        <div class="collapse" id="collapseExample">
          <div class="card card-body">
            This is some content.
          </div>
        </div>
      </div>
    </div>
        2
  •  0
  •   Anuresh VP    6 年前

    你可以把这个包在一个分区里,然后给学生上课 d-flex 给予 flex-grow-1 崩溃

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
    <link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet"/><script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.bundle.min.js"></script>
    <div class="d-flex">
    <p>
      <a class="btn btn-primary" data-toggle="collapse" href="#collapseExample" role="button" aria-expanded="false" aria-controls="collapseExample">
        Link with href
      </a>
    </p>
    <div class="collapse flex-grow-1" id="collapseExample">
      <div class="card card-body">
        This is some content.
      </div>
    </div>
    </div>