我在使用表单内联类时使用Bootstrap标签和输入时发现了一个有趣的问题。标签似乎调整略高于输入。
我只是使用基本的razor html帮助程序来生成这些输入和搜索的锚标记。
<div class="form-inline">
@Html.LabelFor(x => x.StartDate, "From:", new { @class = "form-control input-sm" })
@Html.TextBoxFor(x => x.StartDate, "MM-DD-YYYY", new { @class = "form-control input-sm", @id = "start-date" })
@Html.LabelFor(x => x.EndDate, "To:", new { @class = "form-control input-sm" })
@Html.TextBoxFor(x => x.EndDate, "MM-DD-YYYY", new { @class = "form-control input-sm", @id = "end-date" })
<a id="searchBtn" class="btn btn-primary">Search</a>
愿意提出新的解决方案来解决此内联表单组。但对我来说这看起来令人讨厌和不愉快:(
答案 0 :(得分:-1)
添加一些自定义样式,没有bootstrap的默认样式。检查此示例:
<form>
<label for="email">Email address:</label>
<input type="email" class="xinput" id="email">
<label for="pwd">Password:</label>
<input type="password" class="xinput" id="pwd">
<button type="submit" class="xsubmit">Submit</button>
</form>
CSS:
label{border: 1px solid #ccc;
height: 34px;
padding: 6px 12px;
font-size: 14px;
line-height: 1.42857143;
color: #555;}
.xinput{height: 34px;
border: 1px solid #ccc;
padding: 6px 12px;
font-size: 14px;
line-height: 1.42857143;
color: #555;}
.xsubmit{height: 34px;
padding: 6px 12px;
font-size: 14px;
line-height: 1.42857143;
color: #555; border: none; outline: none; background-color: #008cba; color: white;}