有以下代码:
<div class="form-group ng-scope">
<label class="col-sm-3 control-label" for="without_duration">Without duration</label>
<div class="col-sm-9">
<input class="ng-untouched ng-valid ng-dirty ng-valid-parse" type="checkbox" ng-model="news.without_duration" name="without_duration">
</div>
</div>
问题如下:我在标签中有一些文字,但复选框没有垂直对齐标签。我该如何解决?
答案 0 :(得分:0)
由于这些是浮动的,因此将margin-top
添加到包含复选框的div中,以便它与标签垂直对齐。
答案 1 :(得分:0)
答案 2 :(得分:0)
答案 3 :(得分:0)
嗯,你只需要在pull-left
和label
上使用bootstrap类div
,如图所示 here
<div class="form-group ng-scope">
<label class="col-sm-3 control-label pull-left" for="without_duration">Without duration</label>
<div class="col-sm-9">
<input class="ng-untouched ng-valid pull-left ng-dirty ng-valid-parse" type="checkbox" ng-model="news.without_duration" name="without_duration">
</div>
</div>
问题:由于div
为display: block;
所以复选框转到下一行......
解决方案: JSFIddle ,将float: left;
应用于label
和div
!!
答案 4 :(得分:0)
请在下面查看我的详细信息
<div class="form-group ng-scope">
<div class="col-sm-9"> <label class="col-sm-3 control-label" for="without_duration">Without duration</label>
<input class="ng-untouched ng-valid ng-dirty ng-valid-parse" type="checkbox" ng-model="news.without_duration" name="without_duration">
</div>
</div>
</pre>
or
<div class="form-group ng-scope">
<label class="col-sm-3 control-label" for="without_duration">Without duration</label>
<input class="ng-untouched ng-valid ng-dirty ng-valid-parse" type="checkbox" ng-model="news.without_duration" name="without_duration">
</div>