1、基本实例
单独的表单控件会被自动赋予一些全局样式。所有设置了 .form-control
类的 <input>
、<textarea>
和 <select>
元素都将被默认设置宽度属性为 width: 100%;
。 将 label
元素和前面提到的控件包裹在 .form-group
中可以获得最好的排列。
<!-- 基本实例 --> <form> <div class="from-group"> <label for="email">电子邮箱</label> <input type="text" class="form-control" id="email" placeholder="请输入电子邮箱"> </div> <div class="from-group"> <label for="pswd">密码</label> <input type="password" class="form-control" id="pswd" placeholder="请输入密码"> </div> <div class="from-group"> <label for="file">上传文件</label> <input type="file" id="file"> <p class="help-block">点击上传文件</p> </div> <div class="checkbox"> <label for=""> <input type="checkbox">我同意加入 </label> </div> <button type="submit" class="btn btn-default">提交</button> </form>