asp.net-mvc – 在input-group-addon span和form-control之间获得一个奇怪的空格

我是Bootstrap的新手,在使用input-group和input-group-addon时出现问题.我尽我所能找到其他有同样问题的人,但无济于事.

输入组在md大小的屏幕上看起来很棒,但拒绝在任何其他屏幕大小上与表单控件对齐.

MD:

LG:

xs& SM

这是我的代码:

<div class="form-group col-md-6 col-lg-4">
    @Html.LabelFor(model => model.Weight, new { @class = "control-label col-md-6" })
    <div class="input-group col-md-6">
        @Html.EditorFor(model => model.Weight, new { @class = "form-control" })
        <span class="input-group-addon">lbs</span>
        @Html.ValidationMessageFor(model => model.Weight)
    </div>
</div>

我尝试使用“col-lg-pull-2”拉出插件跨度,这没有任何效果.有任何想法吗?

最佳答案 Html.EditorFor没有一个版本,它接受html属性作为参数..

使用Html.TextBoxFor代替..

点赞