提问者:小点点

在使用ASP.NET mvc(视图)时,如何对齐标签使其位于左侧?


下面我有这个表格,我想要对齐我的标签在左边,然后在右边的texbox。 我如何在我的视图上这样做? 我需要在我的引导程序上使用类吗?

@Html.ValidationSummary(true, "", new { @class = "text-danger" })
                            <div class="form-group">
                                @Html.LabelFor(model => model.Title, htmlAttributes: new { @class = "control-label col-md-2" })
                                <div class="col-md-5">
                                    @Html.EditorFor(model => model.Title, new { htmlAttributes = new { @class = "form-control" } })
                                    @Html.ValidationMessageFor(model => model.Title, "", new { @class = "text-danger" })
                                </div>
                            </div>

共1个答案

匿名用户

尝试在父元素上使用form-inline类,或者可以使用bootstrap的水平形式。 https://getbootstrap.com/docs/4.3/components/forms/#horizeral-form