我尝试在文本框的右侧添加标签以包含值的单位。I would like to have like this
这是我的代码
<div class="form-group ">
@Html.LabelFor(model => model.files, htmlAttributes: new { @class = "control-label col-md-3" })
<div class="col-md-8">
@{ Html.EnableClientValidation(false); }
@Html.EditorFor(model => model.files, new { htmlAttributes = new { @class = "form-control " } })<span>GB</span>
@{ Html.EnableClientValidation(true); }
@Html.ValidationMessageFor(model => model.files, "", new { @class = "text-danger" })
</div>
</div>
感谢。
答案 0 :(得分:1)
class =“col-md-8”包含position:relative。 由于此行具有class =“form control”,并且您的GB没有类。它走向了自然的位置。添加一个类应该告诉它去哪里。
@Html.EditorFor(model => model.files, new { htmlAttributes = new { @class = "form-control col-md-11" } })<span class="col-md-1">GB</span>