本节代码实例只要讲解表单的及控件的UI属性设定,讲解的内容均以注释的方式写出
DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>BootStrap表单title>
<meta charset="utf-8" />
<link href="bootstrap.css" rel="stylesheet" />
head>
<body>
<form role="form" class="form-inline">
<div class="form-group">
<label class="sr-only">emaillabel>
<input type="email" class="form-control" placeholder="Enter email" />
div>
<div class="form-group">
<label>密码label>
<input type="password" class="form-control" placeholder="Enter password" />
div>
<div class="form-group">
<label>选择文件label>
<input type="file" />
<p class="help-block">选择你需要的文件p>
div>
form>
<form class="form-horizontal" role="form">
<div class="form-group">
<label class="col-sm-2 control-label">Emaillabel>
<div class="col-sm-10">
<input type="email" class="form-control" placeholder="Email" />
div>
div>
<div class="form-group">
<label class="col-sm-2 control-label">Passwordlabel>
<div class="col-sm-10">
<input type="email" class="form-control" placeholder="Password" />
div>
div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<div class="checkbox">
<label>
<input type="checkbox" />记住密码
label>
div>
div>
div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-default">登录button>
div>
div>
form>
body>
html>