直接在表单加类class="form-inline",如下:
<form action="#" method="post" class="form-inline">...</form>在label里添加类class="sr-only"如下:
<div class="form-group"> <label for="" class="sr-only">用户名:</label> <input type="text" class="form-control" name="name" placeholder="请输入用户名"> </div> <div class="form-group"> <label for="" class="sr-only">密 码:</label> <input type="password" class="form-control" name="password" placeholder="请输入密码"> </div>checked是默认选中。
<form action="#" method="post"> <div class="checkbox"> <label><input type="checkbox" checked>苹果</label> </div> <div class="checkbox"> <label><input type="checkbox">香蕉</label> </div> <div class="checkbox"> <label><input type="checkbox">橙子</label> </div> <div class="radio"> <label><input type="radio" name="sex" value="M">男</label> </div> </form>给label添加类比如多选框添加class="checkbox-inline",单选框添加class="radio-inline"如下:
<div class="checkbox"> <label class="checkbox-inline"><input type="checkbox" checked>苹果</label> <label class="checkbox-inline"><input type="checkbox">香蕉</label> <label class="checkbox-inline"><input type="checkbox">橙子</label> </div>给input标签添加autofocus
<input type="text" class="form-control" autofocus name="name" placeholder="请输入用户名" >要添加两处:1.表单组要添加类has-feedback如下面第一行。2.sapn添加图标样式和form-control-feedback如下面的span标签。
<div class="form-group has-feedback"> <label for="" class="sr-only">用户名:</label> <input type="text" class="form-control" name="name" placeholder="请输入用户名"> <span class="glyphicon glyphicon-ok form-control-feedback" aria-hidden="true"></span> </div>