我试图在水平表单组类中显示三个小文本框元素。使用代码
<div class="form-group">
<label class="col-lg-3 control-label input-sm">Date of Birth:</label>
<div class="col-lg-4">
<div class="row">
<div class="col-lg-4">
<input type="text" id="txt_month" name="txt_month" class="form-control input-sm" placeholder="MM" required maxlength="2" data-validation-required-message="Month is required" >
</div>
<div class="col-lg-4">
<input type="text" id="txt_day" name="txt_day" class="form-control input-sm" placeholder="DD" required maxlength="2" data-validation-required-message="Day is required" >
</div>
<div class="col-lg-4">
<input type="text" id="txt_year" name="txt_year" class="form-control input-sm" placeholder="YY" required maxlength="4" data-validation-required-message="Year is required" >
</div>
</div>
<p class="help-block"></p>
</div>
</div>
结果:
有没有更好的方法来显示彼此靠近的多个文本框。表单中的其余元素水平显示。
更新#
在使用带有许多其他修改的内联表单类之后,我得到了正确的结果。这是更新的代码。
<div class="form-group">
<label class="col-lg-3 control-label input-sm">Date of Birth:</label>
<div class="col-lg-7">
<div class="form-inline">
<div class="form-group ">
<div class="col-lg-3">
<label class="sronly" for="txt_month">Enter Month</label>
<input type="text" id="txt_month" name="txt_month" class="form-control input-sm" style="width:60px" placeholder="MM" required maxlength="2" data-validation-required-message="Month is required" >
</div>
</div>
<div class="form-group">
<div class="col-lg-3">
<label class="sronly" for="txt_day">Enter Day</label>
<input type="text" id="txt_day" name="txt_day" class="form-control input-sm" style="width:60px" placeholder="DD" required maxlength="2" data-validation-required-message="Day is required" >
</div>
</div>
<div class="form-group">
<div class="col-lg-3">
<label class="sronly" for="txt_year">Enter Year</label>
<input type="text" id="txt_year" name="txt_year" class="form-control input-sm" style="width:60px" placeholder="YY" required maxlength="4" data-validation-required-message="Year is required" >
</div>
</div>
</div>
<p class="help-block"></p>
</div>
</div>
正确结果: