【发布时间】:2018-03-26 05:18:08
【问题描述】:
我正在制作登录表单,但 CSS 无法在密码输入控件和提交按钮上运行时遇到问题。我正在使用 Bootstrap 3.0,我的代码如下。所有其他表单控件都以正确的样式显示。
@using (Html.BeginForm())
{
@Html.AntiForgeryToken()
<div class="form-horizontal">
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
<div class="form-group">
@Html.LabelFor(model => model.UserName, htmlAttributes: new { @class = "control-label" })
@Html.EditorFor(model => model.UserName, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.UserName, "", new { @class = "text-danger" })
</div>
<div class="form-group">
@Html.LabelFor(model => model.Password, htmlAttributes: new { @class = "control-label" })
@Html.PasswordFor(model => model.Password, new { htmlAttributes = new { @class = "form-control", placeholder = "Password" } })
@Html.ValidationMessageFor(model => model.Password, "", new { @class = "text-danger" })
</div>
<div class="form-group">
<input type="submit" value="Login" class="btn btn-primary" />
</div>
</div>
}
这是其显示方式的图像:
密码输入应该和用户名输入一样,按钮的宽度应该和上面的输入一样。
【问题讨论】:
标签: css asp.net asp.net-mvc twitter-bootstrap twitter-bootstrap-3