Bootstrap学习笔记

Bootstrap is the most popular HTML, CSS, and JS framework for developing responsive, mobile first projects on the web.

 1 DOCTYPE html>
 2 <html lang="en">
 3   <head>
 4     <meta charset="utf-8">
 5     <meta http-equiv="X-UA-Compatible" content="IE=edge">
 6     <meta name="viewport" content="width=device-width, initial-scale=1">
 7     
 8     <title>Bootstrap 101 Templatetitle>
 9 
10     
11     <link href="css/bootstrap.min.css" rel="stylesheet">
12 
13     
14     
15     
19   head>
20   <body>
21     <h1>Hello, world!h1>
22 
23     
24     <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js">script>
25     
26     <script src="js/bootstrap.min.js">script>
27   body>
28 html>

 

 1 

Media queries:

 1 /* Extra small devices (phones, less than 768px) */
 2 /* No media query since this is the default in Bootstrap */
 3 
 4 /* Small devices (tablets, 768px and up) */
 5 @media (min-width: @screen-sm-min) { ... }
 6 
 7 /* Medium devices (desktops, 992px and up) */
 8 @media (min-width: @screen-md-min) { ... }
 9  
10 /* Large devices (large desktops, 1200px and up) */
11 @media (min-width: @screen-lg-min) { ... }

Grid options:

 

Extra small devicesPhones

(<768px)

Small devices Tablets

 (≥768px)

Medium devicesDesktops

 (≥992px)

Large devices Desktops

 (≥1200px)

Grid behavior

Horizontal at all times

Collapsed to start, horizontal above breakpoints

Container width

None (auto)

750px

970px

1170px

Class prefix

.col-xs-

.col-sm-

.col-md-

.col-lg-

Offsetting columns:

Move columns to the right using .col-md-offset-* classes.

.col-md-4 .col-md-offset-4

Nesting columns:

Level 1: .col-sm-9
Level 2: .col-xs-8 .col-sm-6
Level 2: .col-xs-4 .col-sm-6
.table 为任意 添加基本样式 (只有横向分隔线) 内添加斑马线形式的条纹 ( IE8 不支持) 内的任一行启用鼠标悬停状态
 
.table-striped
 
.table-bordered 为所有表格的单元格添加边框  
.table-hover
 
.table-condensed 让表格更加紧凑
 1 <form>
 2   <div class="form-group">
 3     <label for="exampleInputEmail1">Email addresslabel>
 4     <input type="email" class="form-control" id="exampleInputEmail1" placeholder="Email">
 5   div>
 6   <div class="form-group">
 7     <label for="exampleInputPassword1">Passwordlabel>
 8     <input type="password" class="form-control" id="exampleInputPassword1" placeholder="Password">
 9   div>
10   <div class="form-group">
11     <label for="exampleInputFile">File inputlabel>
12     <input type="file" id="exampleInputFile">
13     <p class="help-block">Example block-level help text here.p>
14   div>
15   <div class="checkbox">
16     <label>
17       <input type="checkbox"> Check me out
18     label>
19   div>
20   <button type="submit" class="btn btn-default">Submitbutton>
21 form>
Button tags:

Use the button classes on an