Bootstrap CheatSheet

This is a note for learning Bootstrap with a cheat sheet.

Download lib

  1. Download -> Boostrap Download
  2. Choose Compiled and minified CSS, JavaScript, and fonts.
  3. Downland jQuery -> jQuery Download
  4. Choose Download the uncompressed, development jQuery 3.2.1
  5. Copy foldler bootstrap-3.3.7-dist into project under src/main/resources/static
  6. Copy jquery-3.2.1 into src/main/resources/static/js
  7. Copy basic template to index.html
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Bootstrap_Demo</title>

    <!-- Bootstrap -->
    <script src="js/jquery-3.2.1.js"></script>
    <link href="bootstrap-3.3.7-dist/css/bootstrap.css" rel="stylesheet">
    <script src="bootstrap-3.3.7-dist/js/bootstrap.js"></script>

    </head>

Cover

Showcase: Bootstrap Demo

  1. NarBar
  2. Jumbotron
  3. Typograpgy
    1. Alignment and transformation
    2. Float
    3. Block quote
    4. List
    5. Code
    6. Contestual color and background color
  4. Button
    1. Contestual
    2. Size
  5. Form
  6. Table
  7. List group
  8. Panel
  9. Well
  10. Alert
  11. Progress bar
  12. Label
  13. Badge
  14. Image
  15. Grid

Complete Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bootstrap_Demo</title>

<!-- Bootstrap -->
<script src="js/jquery-3.2.1.js"></script>
<link href="bootstrap-3.3.7-dist/css/bootstrap.css" rel="stylesheet">
<script src="bootstrap-3.3.7-dist/js/bootstrap.js"></script>

<!-- Alternative
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">

<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>

<!-- Latest compiled JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
-->

<!-- Customized -->
<style type="text/css">
.navbar{
margin-bottom: 0;
border-radius: 0;
}
</style>

</head>

<body>

<!-- NAVBAR -->
<nav class="navbar navbar-inverse">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed"
data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"
aria-expanded="false">
<span class="sr-only">Toggle navigation</span> <span
class="icon-bar"></span> <span class="icon-bar"></span> <span
class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Bootstrap CheatSheet</a>
</div>

<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse"
id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li class="active"><a href="#">Link <span class="sr-only">(current)</span></a></li>
<li><a href="#">Link</a></li>
<li class="dropdown"><a href="#" class="dropdown-toggle"
data-toggle="dropdown" role="button" aria-haspopup="true"
aria-expanded="false">Dropdown <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li role="separator" class="divider"></li>
<li><a href="#">Separated link</a></li>
<li role="separator" class="divider"></li>
<li><a href="#">One more separated link</a></li>
</ul></li>
</ul>
<form class="navbar-form navbar-left">
<div class="form-group">
<input type="text" class="form-control" placeholder="Search">
</div>
<button type="submit" class="btn btn-default">Submit</button>
</form>
<ul class="nav navbar-nav navbar-right">
<li><a href="#">Link</a></li>
<li class="dropdown"><a href="#" class="dropdown-toggle"
data-toggle="dropdown" role="button" aria-haspopup="true"
aria-expanded="false">Dropdown <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">Action</a></li>
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li role="separator" class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul></li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container-fluid -->
</nav>

<!-- JUMBOTRON -->
<div class="jumbotron text-center">
<div class="container">
<h1>Welcome to Bootstrap CheatSheet</h1>
<p>Lorem Ipsum is simply dummy text of the printing and
typesetting industry. Lorem Ipsum has been the industry's standard
dummy text ever since the 1500s</p>
<a href="#" class="btn btn-primary">Read More</a>
</div>
</div>


<!-- TYPOGRAPHY -->
<div class="container">

<h1 class="page-header">Hello, world! <small>Secondary text</small></h1>

<p class="lead">Lorem Ipsum is simply dummy text of the printing and
typesetting industry. Lorem Ipsum has been the industry's standard
dummy text ever since the 1500s, when an unknown printer took a
Aldus PageMaker including versions of Lorem Ipsum.</p>

<p><mark>Lorem Ipsum is simply dummy</mark> text of the printing and
typesetting industry. Lorem Ipsum has been the industry's standard
dummy text ever since the 1500s, when an unknown printer took a
galley of type and scrambled it to make a type specimen book. It has
survived not <del>only five centuries, but also the leap </del> into electronic
typesetting, remaining essentially unchanged. It was popularised in
the 1960s with the release of Letraset sheets containing Lorem Ipsum
passages, <u>and more recently with desktop publishing</u> software like
Aldus PageMaker including versions of Lorem Ipsum.</p>

<hr>

<!-- ALIGNMENT & TRANSFORMATION -->
<p class="text-left text-lowercase">Left aligned text.</p>
<p class="text-center text-uppercase">Center aligned text.</p>
<p class="text-right text-capitalize">Right aligned text.</p>
<p class="text-justify">Justified text.</p>
<p class="text-nowrap">No wrap text.</p>

<hr>

<!-- QUICK FLOATS -->
<div class="pull-right">Div float to right</div>
<div class="pull-left">Div float to left</div>

<!-- CLEAR FLOATS -->
<div class="clearfix"></div>

<hr>

<!-- BLOCK QUOTE -->
<blockquote class="blockquote">
<p>Lorem Ipsum is simply dummy text of the
printing and typesetting industry. Lorem Ipsum has been the
industry's standard dummy text ever since the 1500s, when an unknown
printer took a Aldus PageMaker including versions of Lorem Ipsum.</p>
<footer>Quote By <cite title="Ryan">Ryan</cite></footer>
</blockquote>

<hr>

<!-- LISTS -->
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>

<!-- CODE -->
<code>&lt;h1&gt;Heading text&lt;/h1&gt;</code>
<br>
change directory with <kbd>cd</kbd>
<br>
to edit settings, press <kbd><kbd>ctrl</kbd>+<kbd>,</kbd></kbd>

<hr>

<!-- CONTESTUAL COLORS -->
<p class="text-primary">Hello World..</p>
<p class="text-success">Hello World..</p>
<p class="text-info">Hello World..</p>
<p class="text-warning">Hello World..</p>
<p class="text-danger">Hello World..</p>
<p class="text-muted">Hello World..</p>

<!-- CONTESTUAL BACKGROUND COLORS -->
<p class="bg-primary">Hello World..</p>
<p class="bg-success">Hello World..</p>
<p class="bg-info">Hello World..</p>
<p class="bg-warning">Hello World..</p>
<p class="bg-danger">Hello World..</p>

</div>

<hr>

<!-- BUTTON -->
<div class="container">

<button class="btn btn-default">Default</button>
<a href="#" class="btn btn-default" role="button">Link</a>
<input type="submit" class="btn btn-default" value="Submit">
<br>

<!-- CONTESTUAL BUTTONS -->
<button class="btn btn-default">Default</button>
<button class="btn btn-primary">primary</button>
<button class="btn btn-success">success</button>
<button class="btn btn-info">info</button>
<button class="btn btn-warning">warning</button>
<button class="btn btn-danger">danger</button>
<button class="btn btn-link">link</button>
<br>

<!-- BUTTON SIZES -->
<button class="btn btn-default btn-lg">Default</button>
<button class="btn btn-default">Default</button>
<button class="btn btn-default btn-sm">Default</button>
<button class="btn btn-default btn-xs" disabled="disabled">Default</button>
</div>

<hr>

<!-- FORMS -->
<div class="container">
<form action="">
<div class="form-group">
<label>Name</label>
<input type="text" class="form-control" placeholder="Add Name">
</div>
<div class="form-group">
<label>Email</label>
<input type="email" class="form-control" placeholder="Add Email">
</div>
<div class="form-group">
<label>Message</label>
<textarea class="form-control" placeholder="Add Name"></textarea>
</div>
<div class="form-group">
<label>Gender</label>
<select class="form-control">
<option value="male">Male</option>
<option value="female">Female</option>
</select>
</div>

<div class="form-group">
<label>Upload File</label>
<input type="file">
<p class="help-block">Only pdf accepted</p>
</div>

<div class="checkbox">
<label>
<input type="checkbox">check me out
</label>
</div>

<button type="submit" class="btn btn-default">Submit</button>
</form>

<hr>

<!-- INLINE FORM -->
<form class="form-inline">
<div class="form-group">
<label>Name</label>
<input type="text" class="form-control" placeholder="Add Name">
</div>
<div class="form-group">
<label>Email</label>
<input type="email" class="form-control" placeholder="Add Email">
</div>
<div class="form-group">
<label>Gender</label>
<select class="form-control">
<option value="male">Male</option>
<option value="female">Female</option>
</select>
</div>

<div class="checkbox">
<label>
<input type="checkbox">check me out
</label>
</div>

<button type="submit" class="btn btn-default">Submit</button>
</form>

</div>

<hr>

<!-- TABLE -->
<div class="container">
<table class="table table-striped table-bordered table-hover table-condensed">
<tr>
<th>FirstName</th>
<th>LastName</th>
<th>Age</th>
</tr>
<tr class="success">
<th>Xu</th>
<th>Luo</th>
<th>30</th>
</tr>
<tr>
<th>Melvin</th>
<th>Tan</th>
<th>32</th>
</tr>
<tr class="danger">
<th>Tim</th>
<th>Park</th>
<th>40</th>
</tr>
</table>
</div>

<hr>
<!-- LIST GROUP -->
<div class="container">
<ul class="list-group">
<li class="list-group-item">Item 1</li>
<li class="list-group-item">Item 2</li>
<li class="list-group-item">Item 3</li>
</ul>

<div class="list-group">
<a href="#" class="list-group-item active">Item 1</a>
<a href="#" class="list-group-item">Item 2</a>
<a href="#" class="list-group-item">Item 3</a>
</div>
</div>

<div class="container">
<!-- PANELS -->
<div class="panel panel-primary">
<div class="panel-heading"><h3 class="panel-title">Panel title</h3></div>
<div class="panel-body">Panel content</div>
<div class="panel-footer">Panel footer</div>
</div>

<hr>

<!-- WELLS -->
<div class="well">Well</div>
<div class="well well-lg">Well large</div>
<div class="well well-sm">Well small</div>

<hr>

<!-- ALERTS -->
<div class="alert alert-success" role="alert">Alert success</div>
<div class="alert alert-info" role="alert">Alert info..</div>
<div class="alert alert-warning" role="alert">Alert warning..</div>
<div class="alert alert-danger" role="alert">Alert danger..</div>

<div class="alert alert-info alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert">
<span>&times;</span>
</button>
you can close this alert..
</div>

<hr>

<!-- PROGRESS BARS -->
<div class="progress">
<div class="progress-bar progress-bar-success progress-bar-striped active" style="width:50%;">
50%
</div>
</div>

<hr>

<!-- LABELS -->
<span class="label label-default">default label</span>
<h1><span class="label label-primary">primary label in h1</span></h1>
<span class="label label-success">success label</span>
<span class="label label-warning">warning label</span>
<span class="label label-danger">danger label</span>

<hr>

<!-- BADGES -->
<a href="#">Inbox <span class="badge">50</span></a>
<button class="btn">Messages <span class="badge">9</span> </button>

<hr>
</div>

<!-- IMAGES -->
<div class="container">
<img alt="" class="thumbnail" src="https://goo.gl/LpLNct">
<img alt="" class="img-rounded" src="https://goo.gl/LpLNct">
<img alt="" class="img-circle" src="https://goo.gl/LpLNct">
</div>

<hr>

<!-- GRIDS -->
<div class=" container">
<div class="row">
<div class="col-md-8 col-sm-8 col-xs-8">
<p>Lorem Ipsum is simply dummy text of the printing and
typesetting industry. Lorem Ipsum has been the industry's standard
dummy text ever since the 1500s, when an unknown printer took a
Aldus PageMaker including versions of Lorem Ipsum.</p>
</div>
<div class="col-md-4 col-sm-4 col-xs-4">
<p>Lorem Ipsum is simply dummy text of the printing and
typesetting industry. Lorem Ipsum has been the industry's.</p>
</div>
</div>
<hr>
<div class="row">
<div class="col-md-3">
<p>Lorem Ipsum is simply dummy text of the printing and
typesetting industry. Lorem Ipsum has been the industry's.</p>
</div>
<div class="col-md-3">
<p>Lorem Ipsum is simply dummy text of the printing and
typesetting industry. Lorem Ipsum has been the industry's.</p>
</div>
<div class="col-md-3">
<p>Lorem Ipsum is simply dummy text of the printing and
typesetting industry. Lorem Ipsum has been the industry's.</p>
</div>
<div class="col-md-3">
<p>Lorem Ipsum is simply dummy text of the printing and
typesetting industry. Lorem Ipsum has been the industry's.</p>
</div>
</div>
</div>

<div style="height:200px"></div>
</body>

</html>