我尝试使用bootstrap格式化表单页面,其中一些输入具有可见标签,而另一些输入则没有。根据{{3}}(列大小调整部分),我必须包含" row"用于设置输入大小的类,但是当我将sr-only类添加到某些标签时,它不适合。有什么建议? bootstrap documentation,TypeId和DV未对齐
一般信息
<div class="form-group col-xs-6">
<label class="control-label" for="fullname">Full name</label>
<input id="fullname" name="fullname" type="text"
class="form-control input-md"></input>
</div>
<div class="form-group col-xs-2">
<label class="control-label sr-only" for="TypeId">Type Id</label>
<select id="TypeId" name="TypeId" class="form-control input-md ">
<option value="CC">CC</option>
<option value="NIT">NIT</option>
<option value="NUIP">NUIP</option>
<option value="CE">CE</option>
<option value="PA">PA</option>
<option value="TI">TI</option>
</select>
</div>
<div class="form-group col-xs-3">
<label class="control-label" for="id">Id</label>
<input id="id" name="id" type="text" class="form-control input-md"></input>
</div>
<div class="form-group col-xs-1">
<label class="control-label sr-only" for="DV">DV</label>
<input id="DV" name="DV" type="text"
class="form-control input-md"></input>
</div>
</fieldset>
答案 0 :(得分:2)
快速(和hacky!)修复是在sr-only
标签之后添加另一个标签,该标签仅包含
且没有for
属性:
<div class="form-group col-xs-2">
<label class="control-label sr-only" for="TypeId">Type Id</label>
<label class="control-label"> </label>
<select id="TypeId" name="TypeId" class="form-control input-md ">
<option value="CC">CC</option>
<option value="NIT">NIT</option>
<option value="NUIP">NUIP</option>
<option value="CE">CE</option>
<option value="PA">PA</option>
<option value="TI">TI</option>
</select>
</div>