演示http://bootply.com/103569
可以使用像这样的偏移:
要么
http://getbootstrap.com/css/#grid-offsetting
演示http://bootply.com/103569
可以使用像这样的偏移:
<div class="container"> <div class="row clearfix"> <div class="col-md-6 col-md-offset-3 column"> <form role="form"> <div class="form-group"> <label for="exampleInputEmail1">Email address</label><input type="email" class="form-control" id="exampleInputEmail1" /> </div> <div class="form-group"> <label for="exampleInputPassword1">Password</label><input type="password" class="form-control" id="exampleInputPassword1" /> </div> <div class="form-group"> <label for="exampleInputFile">File input</label><input type="file" id="exampleInputFile" /> <p class="help-block"> Example block-level help text here. </p> </div> <div class="checkbox"> <label><input type="checkbox" /> Check me out</label> </div> <button type="submit" class="btn btn-default">Submit</button> </form> </div> </div> <div class="row clearfix"> <div class="col-md-12 column"> </div> </div> </div>
要么
<div class="container"> <div class="row clearfix"> <div class="col-md-12 column"> <div class="col-md-6 col-md-offset-3 column"> <form role="form"> <div class="form-group"> <label for="exampleInputEmail1">Email address</label><input type="email" class="form-control" id="exampleInputEmail1" /> </div> <div class="form-group"> <label for="exampleInputPassword1">Password</label><input type="password" class="form-control" id="exampleInputPassword1" /> </div> <div class="form-group"> <label for="exampleInputFile">File input</label><input type="file" id="exampleInputFile" /> <p class="help-block"> Example block-level help text here. </p> </div> <div class="checkbox"> <label><input type="checkbox" /> Check me out</label> </div> <button type="submit" class="btn btn-default">Submit</button> </form> </div> </div> </div> </div>
http://getbootstrap.com/css/#grid-offsetting