使用ASP.Net MVC 5,我试图让三个复选框与其他字段对齐,如下所示(红线表示我想要的位置)
教区和致谢的代码 - 其余部分大致相同,但针对不同的领域 - 如下:
<div class="form-group">
@Html.LabelFor(model => model.Diocese, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.Diocese, new { htmlAttributes = new { @class = "form-control input-width-xlarge" } })
@Html.ValidationMessageFor(model => model.Diocese, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.Acknowledgement, htmlAttributes: new {@class = "control-label col-md-2"})
<div class="col-md-10 checkbox">
@Html.EditorFor(model => model.Acknowledgement)
@Html.ValidationMessageFor(model => model.Acknowledgement, "", new { @class = "text-danger" })
</div>
</div>
我认为md-x类会对齐它们,但我明显错了:)
答案 0 :(得分:0)
解决。将EditorFor更改为CheckBoxFor,在其周围添加标签,将padding-left设置为15。