[英]Bootstrap spacing issues with btn-group
I'm having spacing issues with the following markup.我遇到以下标记的间距问题。
<h2>Profitability Report</h2>
<form method="post">
<div class="row">
<div class="col-md-12">
<div class="btn-group btn-group-toggle" data-toggle="buttons">
<label class="btn btn-secondary active">
<input type="radio" name="reporttype" id="option1" value="0" autocomplete="off" checked> Monthly
</label>
<label class="btn btn-secondary">
<input type="radio" name="reporttype" id="option2" value="1" autocomplete="off"> Quarterly
</label>
<label class="btn btn-secondary">
<input type="radio" name="reporttype" id="option3" value="2" autocomplete="off"> Annual
</label>
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<select id="date-options" asp-for="ReportSettings.MonthCode" class="form-control"></select>
</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="form-group">
<select id="date-options" asp-for="ReportSettings.MonthCode" class="form-control"></select>
</div>
</div>
</div>
</form>
The spacing between the second and third row is what I'd expect.第二行和第三行之间的间距是我所期望的。 But why is there no spacing between the first and second row?但是为什么第一排和第二排之间没有间距呢?
Add the form-group
class to your div container.将form-group
class 添加到您的 div 容器中。 It's what's different and provides the margin.它是不同的,并提供了利润。
<div class="form-group btn-group btn-group-toggle" data-toggle="buttons">
There is no spacing provided by the .row
class - In your example the .form-group
in 2nd and 3rd row has a bottom margin while the first row does not have an element with this class. .row
class 没有提供间距 - 在您的示例中,第 2 行和第 3 行中的.form-group
具有底部边距,而第一行没有具有此 class 的元素。 If using Bootstrap 4 you could add mb-3
class or similar to the first row to achieve the desired result.如果使用 Bootstrap 4,您可以添加mb-3
class 或与第一行类似的内容来实现所需的结果。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.