把下面的链接添加到你需要使用 Bootstrap 来进行布局的应用的头部:
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap /3.3.1/css/bootstrap.min.css"/>
需要把所有的 HTML 内容放在一个包含有container-fluid
class 名称的div
下。
我们只要给图片添加 img-responsive
的 class 属性,图片的宽度就能自动适配你手机屏幕的宽度
我们只需要给h2
标签添加text-center
的 class 属性,标题文字就可以居中了
<button class="btn">Like</button>
<button class="btn btn-block">Like</button>
<button class="btn btn-block btn-primary">Like</button>
<button class="btn btn-block btn-info">Info</button>
<button class="btn btn-block btn-danger">Delete</button>
<div class="row">
<div class="col-xs-4">
<button class="btn btn-block btn-primary">Like</button>
</div>
<div class="col-xs-4">
<button class="btn btn-block btn-info">Info</button>
</div>
<div class="col-xs-4">
<button class="btn btn-block btn-danger">Delete</button>
</div>
</div>
Top 3 things cats hate:
<div class="row">
<div class="col-xs-8">
<h2 class="text-primary text-center">CatPhotoApp</h2>
</div>
<div class="col-xs-4">
<a href="#"><img class="img-responsive thick-green-border" src="/statics/codecamp/images/relaxing-cat.jpg"></a>
</div>
</div>
Font Awesome 是一个方便的图标库。 这些图标都是矢量图形,以.svg 文件格式存储。
precondition
<link rel =“stylesheet”href =“// maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css”/>
example:
<button class="btn btn-block btn-primary">Like<i class="fa fa-thumbs-up"></i></button>
<button class="btn btn-block btn-info">Info<i class="fa fa-info-circle"></i></button>
<div class="row">
<div class="col-xs-6">
<label><input type="radio" name="indoor-outdoor"> Indoor</label>
</div>
<div class="col-xs-6">
<label><input type="radio" name="indoor-outdoor"> Outdoor</label>
</div>
</div>
<div class="row">
<div class="col-xs-4">
<label><input type="checkbox" name="personality"> Loving</label>
</div>
<div class="col-xs-4">
<label><input type="checkbox" name="personality"> Lazy</label>
</div>
<div class="col-xs-4">
<label><input type="checkbox" name="personality"> Crazy</label>
</div>
</div>
<input type="text" placeholder="cat photo URL" class="form-control" required>
<button type="submit" class="btn btn-primary"><i class="fa fa-paper-plane"></i>Submit</button>
<h3 class="text-primary text-center">jQuery Playground</h3>
<h3 class="text-primary text-center">jQuery Playground</h3>