我正在使用Bootstrap 2.3.2作为一个网站,其中包含一个手风琴元素,其中包含一行。手风琴是span6,我预计该行将能够包含两个span3元素,但它不能。这是我简化的代码:
<div class="span6">
<div class="accordion" id="accordion2">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseOne">
<p><h3>Some text here</h3></p>
</a>
</div>
<div id="collapseOne" class="accordion-body collapse">
<div class="accordion-inner">
<div class="row">
<br />
<div class="span3 offer">
<div class="offer-wrap">
This one should be on the left
</div>
</div>
<div class="span3 offer">
<div class="offer-wrap">
This one should be on the right, but is BELOW
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
我能够让它们彼此相邻,但只有一些令人讨厌的CSS摆弄,这只适用于我的屏幕尺寸。
预期行为:http://imgur.com/O1z4mZN 实际结果:http://imgur.com/fP568Tl
如果我将那一行放在手风琴元素之外,一切看起来都很完美。
答案 0 :(得分:3)
这与手风琴和.span
类的边缘有关。
我的提示:永远不要使用.row
类,始终使用.row-fluid
类。使用.row-fluid
,您始终可以将可用宽度拆分为12列。
<div class="span6">
<div class="accordion" id="accordion2">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseOne">
<p><h3>Some text here</h3></p>
</a>
</div>
<div id="collapseOne" class="accordion-body collapse">
<div class="accordion-inner">
<br />
<div class="row-fluid">
<div class="span6 offer">
<div class="offer-wrap">
This one should be on the left
</div>
</div>
<div class="span6 offer">
<div class="offer-wrap">
This one should be on the right, but is BELOW
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>