我正在使用Bootstrap 3.3.7。我有一个带有无标签复选框的水平表单,如下所示:
<div class="container-fluid" style="max-width:600px">
<form class="form-horizontal">
<div class="form-group">
<label class="control-label col-sm-2" for="field1">Field 1:</label>
<div class="col-sm-8">
<input class="form-control" type="text" id="field1"/>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="field2">Field 2:</label>
<div class="col-sm-8">
<input class="form-control" type="text" id="field2"/>
</div>
</div>
<div class="form-group">
<label class="control-label col-sm-2" for="field3">Field 3:</label>
<div class="col-sm-8">
<!-- HERE IS THE CHECKBOX: -->
<input class="form-control" type="checkbox" id="field3"/>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-8">
<button class="btn btn-default btn-primary" type="submit">Apply Changes</button>
</div>
</div>
</form>
</div>
我创建了Bootply demo here。
问题是复选框居中。我希望它左对齐,因此左边缘与其上方文本输入的左边缘对齐。
我该怎么做?
我试过了:
text-left
添加到包含复选框的div(结果:无效果)。label
标记中附上复选框输入,在阅读this post之后进行疯狂猜测(结果:它消失了)。我没有想法。
答案 0 :(得分:15)
您可以在复选框中添加课程吗?试试这个:
<input class="form-control move-left" type="checkbox" id="field3">
.move-left {
width: auto;
box-shadow: none;
}
演示:http://www.bootply.com/At8YVfnm5F
根据gyre的评论更新了。
答案 1 :(得分:5)
您可以更改输入ID LiveOnBootplay
的宽度初始值或自动值Plotly.d3.json('https://raw.githubusercontent.com/plotly/datasets/master/custom_heatmap_colorscale.json', function(figure) {
var data = [{
z: figure.z,
colorscale: 'Jet',
type: 'heatmap'
}
];
var layout = {title: 'Jet'};
Plotly.newPlot('myDiv', data, layout);
});
答案 2 :(得分:4)
尝试将包含复选框的div类更改为col-sm-8
到col-sm-1
,然后在输入元素中添加checkbox-inline
类。
演示: http://www.bootply.com/kjF1gVtWDC
<div class="col-sm-1">
<!-- HERE IS THE CHECKBOX: -->
<input class="form-control checkbox-inline" type="checkbox" id="field3" />
</div>