手风琴内的卡片项目 class 未水平放置 BOOTSTRAP 4

Card items inside of a accordion class not being horizontal positioned BOOTSTRAP 4

我正在尝试水平对齐这些手风琴项目。不管出于什么原因,尽管他们拒绝我使用 bootstrap 4,而且我知道我使用的方法在 bootstrap 3 中有效,如果有人可以为此提供修复,我们将不胜感激。

jsfiddle:

https://jsfiddle.net/bhb6q929/

HTML

<div class="container">


<div class="row">
            <div class="col-lg-2"> </div>
            <div class="col-lg-8">
                <div id="accordion" role="tablist" aria-multiselectable="true">
                    <div class="card">
                        <div class="card-header" role="tab" id="headingOne">
                            <h5 class="mb-0 text-center">
        <a data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
          Type
        </a>
      </h5> </div>
                        <div class="row">
                            <div id="collapseOne" class="collapse show" role="tabpanel" aria-labelledby="headingOne">
                                <div class="col-md-4 text-center">
                                    <button type="button" class="btn btn-default card-block" aria-label="Left Align"> <img src="http://iconmonstr.com/wp-content/g/gd/makefg.php?i=../assets/preview/2012/png/iconmonstr-laptop-4.png&r=0&g=0&b=0"> </button>
                                </div>
                                <div class="col-md-4 text-center">
                                    <button type="button" class="btn btn-default card-block" aria-label="Left Align"> <img src="http://iconmonstr.com/wp-content/g/gd/makefg.php?i=../assets/preview/2012/png/iconmonstr-tablet-1.png&r=0&g=0&b=0"> </button>
                                </div>
                                <div class="col-md-4 text-center">
                                    <button type="button" class="btn btn-default card-block" aria-label="Left Align"> <img src="http://iconmonstr.com/wp-content/g/gd/makefg.php?i=../assets/preview/2012/png/iconmonstr-smartphone-3.png&r=0&g=0&b=0"> </button>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="card">
                        <div class="card-header" role="tab" id="headingTwo">
                            <h5 class="mb-0 text-center">
        <a class="collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
          Model
        </a>
      </h5> </div>
                        <div id="collapseTwo" class="collapse" role="tabpanel" aria-labelledby="headingTwo">
                            <div class="card-block"> Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod.</div>
                        </div>
                    </div>
                    <div class="card">
                        <div class="card-header" role="tab" id="headingThree">
                            <h5 class="mb-0 text-center">
        <a class="collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapseThree" aria-expanded="false" aria-controls="collapseThree">
          Collapsible Group Item #3
        </a>
      </h5> </div>
                        <div id="collapseThree" class="collapse" role="tabpanel" aria-labelledby="headingThree">
                            <div class="card-block"> Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-lg-2"> </div>
        </div>
        </div>

CSS:

html {
    padding: 0px;
}
body {
    font-size: 17px;
    line-height: 1.52947;
    font-weight: 400;
    letter-spacing: -0.021em;
    font-family: "SF Pro Text","SF Pro Icons","Helvetica Neue","Helvetica","Arial",sans-serif;
    background-color: white;
    color: #333;
    font-style: normal;
}

这个小小的 CSS 代码就可以完成这项工作。

.card{float:left;}

而且我还建议删除第一个节目的手风琴class

<div id="collapseOne" class="collapse show" ....> 

<div id="collapseOne" class="collapse" ...>

对于Bootstrap4,使用这样的嵌套网格。

 <div id="accordion" class="row no-gutters">
          <div class="col">
              <div class="card">..</div>
          </div>
          <div class="col">
              <div class="card">..</div>
          </div>
          <div class="col">
              <div class="card">..</div>
          </div>
 </div>

http://www.codeply.com/go/BVmPyKItT4

float:left手风琴打开时效果不佳