【发布时间】:2019-12-04 19:28:03
【问题描述】:
我创建了一个标准的创建页面。我已将 @style = "height: 25" 添加到标签和编辑器行。我的目标是改变文本框的高度,这很好,但是在我这样做之后标签没有在文本框的中间对齐?
所以我的第一个问题是,如何将标签与文本框居中对齐?
其次,我想在整个页面上没有所有文本框之间的所有间距。有没有一种简单的方法可以压缩所有的间距?
谢谢, 乙
@model Intranet.Models.Order
@{
ViewBag.Title = "CreateOrder";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<h2>Create Order</h2>
@using (Html.BeginForm())
{
@Html.AntiForgeryToken()
<div class="form-horizontal">
<hr />
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
<div class="form-group">
@Html.LabelFor(model => model.Borrower, htmlAttributes: new { @class = "control-label col-md-2", @style = "height: 25px" })
<div class="col-md-10">
@Html.EditorFor(model => model.Borrower, new { htmlAttributes = new { @class = "form-control", @style = "height: 25px" } })
@Html.ValidationMessageFor(model => model.Borrower, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.Amount, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.Amount, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Amount, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.Officer, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.Officer, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.Officer, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Create" class="btn btn-default" />
</div>
</div>
</div>
}
<div>
@Html.ActionLink("Back to List", "Index")
</div>
【问题讨论】:
-
请使用呈现的代码/html 更新您的问题,以使我们能够更好地为您提供帮助 - 也许作为一个带有引导程序的 sn-p,通过 cdn 在您的问题中重现此问题。跨度>
标签: css asp.net-mvc twitter-bootstrap