我正在使用 MVC 和引导程序来创建一个网站,并且大部分时间都在尝试使用它并发现以下内容:
在导航栏中创建内联表单时,我注意到输入元素之间的间距不正确。我想我发现这是由 Razor 引擎生成的标记引起的,它们彼此相邻呈现的元素之间没有空白,没有任何间距。但我不确定如何解决它。
这是无效行为的jsfiddle。
剃刀
@using (Html.BeginForm("JsonLogin", "Account", FormMethod.Post, new { @class = "navbar-form" }))
{
@Html.TextBoxFor(m => m.UserName, new { @class = "input-small", placeholder = @Html.DisplayNameFor(m => m.UserName) })
@Html.PasswordFor(m => m.Password, new { @class = "input-small", placeholder = @Html.DisplayNameFor(m => m.Password) })
}
html
<form class="navbar-form">
<input type="text" class="input-small" placeholder="Email"><input type="password" class="input-small" placeholder="Password">
</form>
这是有效行为的jsfiddle。
html
<form class="navbar-form">
<input type="text" class="input-small" placeholder="Email">
<input type="password" class="input-small" placeholder="Password">
</form>
关于如何解决这个问题的任何想法?我猜我在引导程序中遗漏了一些东西。</p>