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
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
|
<!-- Masthead
================================================== -->
<header class="jumbotron subhead" id="overview">
<h1>{{_i}}Scaffolding{{/i}}</h1>
<p class="lead">{{_i}}Bootstrap is built on a responsive 12-column grid. We've also included fixed- and fluid-width layouts based on that system.{{/i}}</p>
<div class="subnav">
<ul class="nav nav-pills">
<li><a href="#global">{{_i}}Global styles{{/i}}</a></li>
<li><a href="#gridSystem">{{_i}}Grid system{{/i}}</a></li>
<li><a href="#fluidGridSystem">{{_i}}Fluid grid system{{/i}}</a></li>
<li><a href="#gridCustomization">{{_i}}Customizing{{/i}}</a></li>
<li><a href="#layouts">{{_i}}Layouts{{/i}}</a></li>
<li><a href="#responsive">{{_i}}Responsive design{{/i}}</a></li>
</ul>
</div>
</header>
<!-- Global Bootstrap settings
================================================== -->
<section id="global">
<div class="page-header">
<h1>{{_i}}Global styles <small>for CSS reset, typography, and links</small>{{/i}}</h1>
</div>
<div class="row">
<div class="span4">
<h2>{{_i}}Requires HTML5 doctype{{/i}}</h2>
<p>{{_i}}Bootstrap makes use of HTML elements and CSS properties that require the use of the HTML5 doctype. Be sure to include it at the beginning of every Bootstrapped page in your project.{{/i}}</p>
<pre class="prettyprint linenums">
<!DOCTYPE html>
<html lang="en">
...
</html>
</pre>
</div><!-- /.span -->
<div class="span4">
<h2>{{_i}}Typography and links{{/i}}</h2>
<p>{{_i}}Within the <strong>scaffolding.less</strong> file, we set basic global display, typography, and link styles. Specifically, we:{{/i}}</p>
<ul>
<li>{{_i}}Remove margin on the body{{/i}}</li>
<li>{{_i}}Set <code>background-color: white;</code> on the <code>body</code>{{/i}}</li>
<li>{{_i}}Use the <code>@baseFontFamily</code>, <code>@baseFontSize</code>, and <code>@baseLineHeight</code> attributes as our typographyic base{{/i}}</li>
<li>{{_i}}Set the global link color via <code>@linkColor</code> and apply link underlines only on <code>:hover</code>{{/i}}</li>
</ul>
</div><!-- /.span -->
<div class="span4">
<h2>{{_i}}Reset via Normalize{{/i}}</h2>
<p>{{_i}}As of Bootstrap 2, the traditional CSS reset has evolved to make use of elements from <a href="http://necolas.github.com/normalize.css/" target="_blank">Normalize.css</a>, a project by <a href="http://twitter.com/necolas" target="_blank">Nicolas Gallagher</a> that also powers the <a href="http://html5boilerplate.com" target="_blank">HTML5 Boilerplate</a>.{{/i}}</p>
<p>{{_i}}The new reset can still be found in <strong>reset.less</strong>, but with many elements removed for brevity and accuracy.{{/i}}</p>
</div><!-- /.span -->
</div><!-- /.row -->
</section>
<!-- Grid system
================================================== -->
<section id="gridSystem">
<div class="page-header">
<h1>{{_i}}Default grid system <small>12 columns with a responsive twist</small>{{/i}}</h1>
</div>
<div class="row show-grid">
<div class="span1">1</div>
<div class="span1">1</div>
<div class="span1">1</div>
<div class="span1">1</div>
<div class="span1">1</div>
<div class="span1">1</div>
<div class="span1">1</div>
<div class="span1">1</div>
<div class="span1">1</div>
<div class="span1">1</div>
<div class="span1">1</div>
<div class="span1">1</div>
</div>
<div class="row show-grid">
<div class="span4">4</div>
<div class="span4">4</div>
<div class="span4">4</div>
</div>
<div class="row show-grid">
<div class="span4">4</div>
<div class="span8">8</div>
</div>
<div class="row show-grid">
<div class="span6">6</div>
<div class="span6">6</div>
</div>
<div class="row show-grid">
<div class="span12">12</div>
</div>
<div class="row">
<div class="span4">
<p>{{_i}}The default grid system provided in Bootstrap utilizes <strong>12 columns</strong> that render out at widths of 724px, 940px (default without responsive CSS included), and 1170px. Below 767px viewports, the columns become fluid and stack vertically. {{/i}}</p>
</div><!-- /.span -->
<div class="span4">
<pre class="prettyprint linenums">
<div class="row">
<div class="span4">...</div>
<div class="span8">...</div>
</div>
</pre>
</div><!-- /.span -->
<div class="span4">
<p>{{_i}}As shown here, a basic layout can be created with two "columns", each spanning a number of the 12 foundational columns we defined as part of our grid system.{{/i}}</p>
</div><!-- /.span -->
</div><!-- /.row -->
<br>
<h2>{{_i}}Offsetting columns{{/i}}</h2>
<div class="row show-grid">
<div class="span4">4</div>
<div class="span4 offset4">4 offset 4</div>
</div><!-- /row -->
<div class="row show-grid">
<div class="span3 offset3">3 offset 3</div>
<div class="span3 offset3">3 offset 3</div>
</div><!-- /row -->
<div class="row show-grid">
<div class="span8 offset4">8 offset 4</div>
</div><!-- /row -->
<pre class="prettyprint linenums">
<div class="row">
<div class="span4">...</div>
<div class="span4 offset4">...</div>
</div>
</pre>
<br>
<h2>{{_i}}Nesting columns{{/i}}</h2>
<div class="row">
<div class="span6">
<p>{{_i}}With the static (non-fluid) grid system in Bootstrap, nesting is easy. To nest your content, just add a new <code>.row</code> and set of <code>.span*</code> columns within an existing <code>.span*</code> column.{{/i}}</p>
<h3>{{_i}}Example{{/i}}</h3>
<p>{{_i}}Nested rows should include a set of columns that add up to the number of columns of it's parent. For example, two nested <code>.span3</code> columns should be placed within a <code>.span6</code>.{{/i}}</p>
<div class="row show-grid">
<div class="span6">
{{_i}}Level 1 of column{{/i}}
<div class="row show-grid">
<div class="span3">
{{_i}}Level 2{{/i}}
</div>
<div class="span3">
{{_i}}Level 2{{/i}}
</div>
</div>
</div>
</div>
</div><!-- /.span -->
<div class="span6">
<pre class="prettyprint linenums">
<div class="row">
<div class="span6">
{{_i}}Level 1 column{{/i}}
<div class="row">
<div class="span3">{{_i}}Level 2{{/i}}</div>
<div class="span3">{{_i}}Level 2{{/i}}</div>
</div>
</div>
</div>
</pre>
</div><!-- /.span -->
</div><!-- /.row -->
</section>
<!-- Fluid grid system
================================================== -->
<section id="fluidGridSystem">
<div class="page-header">
<h1>{{_i}}Fluid grid system <small>12 responsive, percent-based columns</small>{{/i}}</h1>
</div>
<h2>{{_i}}Fluid columns{{/i}}</h2>
<div class="row-fluid show-grid">
<div class="span1">1</div>
<div class="span1">1</div>
<div class="span1">1</div>
<div class="span1">1</div>
<div class="span1">1</div>
<div class="span1">1</div>
<div class="span1">1</div>
<div class="span1">1</div>
<div class="span1">1</div>
<div class="span1">1</div>
<div class="span1">1</div>
<div class="span1">1</div>
</div>
<div class="row-fluid show-grid">
<div class="span4">4</div>
<div class="span4">4</div>
<div class="span4">4</div>
</div>
<div class="row-fluid show-grid">
<div class="span4">4</div>
<div class="span8">8</div>
</div>
<div class="row-fluid show-grid">
<div class="span6">6</div>
<div class="span6">6</div>
</div>
<div class="row-fluid show-grid">
<div class="span12">12</div>
</div>
<div class="row">
<div class="span4">
<h3>{{_i}}Percents, not pixels{{/i}}</h3>
<p>{{_i}}The fluid grid system uses percents for column widths instead of fixed pixels. It also has the same responsive variations as our fixed grid system, ensuring proper proportions for key screen resolutions and devices.{{/i}}</p>
</div><!-- /.span -->
<div class="span4">
<h3>{{_i}}Fluid rows{{/i}}</h3>
<p>{{_i}}Make any row fluid simply by changing <code>.row</code> to <code>.row-fluid</code>. The columns stay the exact same, making it super straightforward to flip between fixed and fluid layouts.{{/i}}</p>
</div><!-- /.span -->
<div class="span4">
<h3>{{_i}}Markup{{/i}}</h3>
<pre class="prettyprint linenums">
<div class="row-fluid">
<div class="span4">...</div>
<div class="span8">...</div>
</div>
</pre>
</div><!-- /.span -->
</div><!-- /.row -->
<h2>{{_i}}Fluid nesting{{/i}}</h2>
<div class="row">
<div class="span6">
<p>{{_i}}Nesting with fluid grids is a bit different: the number of nested columns doesn't need to match the parent. Instead, your columns are reset at each level because each row takes up 100% of the parent column.{{/i}}</p>
<div class="row-fluid show-grid">
<div class="span12">
{{_i}}Fluid 12{{/i}}
<div class="row-fluid show-grid">
<div class="span6">
{{_i}}Fluid 6{{/i}}
</div>
<div class="span6">
{{_i}}Fluid 6{{/i}}
</div>
</div>
</div>
</div>
</div><!-- /.span -->
<div class="span6">
<pre class="prettyprint linenums">
<div class="row-fluid">
<div class="span12">
{{_i}}Level 1 of column{{/i}}
<div class="row-fluid">
<div class="span6">{{_i}}Level 2{{/i}}</div>
<div class="span6">{{_i}}Level 2{{/i}}</div>
</div>
</div>
</div>
</pre>
</div><!-- /.span -->
</div><!-- /.row -->
</section>
<!-- Customizaton
================================================== -->
<section id="gridCustomization">
<div class="page-header">
<h1>{{_i}}Grid customization{{/i}}</h1>
</div>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>{{_i}}Variable{{/i}}</th>
<th>{{_i}}Default value{{/i}}</th>
<th>{{_i}}Description{{/i}}</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>@gridColumns</code></td>
<td>12</td>
<td>{{_i}}Number of columns{{/i}}</td>
</tr>
<tr>
<td><code>@gridColumnWidth</code></td>
<td>60px</td>
<td>{{_i}}Width of each column{{/i}}</td>
</tr>
<tr>
<td><code>@gridGutterWidth</code></td>
<td>20px</td>
<td>{{_i}}Negative space between columns{{/i}}</td>
</tr>
</tbody>
</table>
<div class="row">
<div class="span4">
<h3>{{_i}}Variables in LESS{{/i}}</h3>
<p>{{_i}}Built into Bootstrap are a handful of variables for customizing the default 940px grid system, documented above. All variables for the grid are stored in variables.less.{{/i}}</p>
</div><!-- /.span -->
<div class="span4">
<h3>{{_i}}How to customize{{/i}}</h3>
<p>{{_i}}Modifying the grid means changing the three <code>@grid*</code> variables and recompiling Bootstrap. Change the grid variables in variables.less and use one of the <a href="less.html#compiling">four ways documented to recompile</a>. If you're adding more columns, be sure to add the CSS for those in grid.less.{{/i}}</p>
</div><!-- /.span -->
<div class="span4">
<h3>{{_i}}Staying responsive{{/i}}</h3>
<p>{{_i}}Customization of the grid only works at the default level, the 940px grid. To maintain the responsive aspects of Bootstrap, you'll also have to customize the grids in responsive.less.{{/i}}</p>
</div><!-- /.span -->
</div><!-- /.row -->
</section>
<!-- Layouts (Default and fluid)
================================================== -->
<section id="layouts">
<div class="page-header">
<h1>{{_i}}Layouts <small>Basic templates to create webpages</small>{{/i}}</h1>
</div>
<div class="row">
<div class="span6">
<h2>{{_i}}Fixed layout{{/i}}</h2>
<p>{{_i}}The default and simple 940px-wide, centered layout for just about any website or page provided by a single <code><div class="container"></code>.{{/i}}</p>
<div class="mini-layout">
<div class="mini-layout-body"></div>
</div>
<pre class="prettyprint linenums">
<body>
<div class="container">
...
</div>
</body>
</pre>
</div><!-- /.span -->
<div class="span6">
<h2>{{_i}}Fluid layout{{/i}}</h2>
<p>{{_i}}<code><div class="container-fluid"></code> gives flexible page structure, min- and max-widths, and a left-hand sidebar. It's great for apps and docs.{{/i}}</p>
<div class="mini-layout fluid">
<div class="mini-layout-sidebar"></div>
<div class="mini-layout-body"></div>
</div>
<pre class="prettyprint linenums">
<div class="container-fluid">
<div class="row-fluid">
<div class="span2">
<!--{{_i}}Sidebar content{{/i}}-->
</div>
<div class="span10">
<!--{{_i}}Body content{{/i}}-->
</div>
</div>
</div>
</pre>
</div><!-- /.span -->
</div><!-- /.row -->
</section>
<!-- Responsive design
================================================== -->
<section id="responsive">
<div class="page-header">
<h1>{{_i}}Responsive design <small>Media queries for various devices and resolutions</small>{{/i}}</h1>
</div>
<!-- Supported devices -->
<div class="row">
<div class="span4">
<p><img src="assets/img/responsive-illustrations.png" alt="Responsive devices"></p>
<h3>{{_i}}What they do{{/i}}</h3>
<p>{{_i}}Media queries allow for custom CSS based on a number of conditions—ratios, widths, display type, etc—but usually focuses around <code>min-width</code> and <code>max-width</code>.{{/i}}</p>
<ul>
<li>{{_i}}Modify the width of column in our grid{{/i}}</li>
<li>{{_i}}Stack elements instead of float wherever necessary{{/i}}</li>
<li>{{_i}}Resize headings and text to be more appropriate for devices{{/i}}</li>
</ul>
<p>{{_i}}Use media queries responsibly and only as a start to your mobile audiences. For larger projects, do consider dedicated code bases and not layers of media queries.{{/i}}</p>
</div><!-- /.span -->
<div class="span8">
<h2>{{_i}}Supported devices{{/i}}</h2>
<p>{{_i}}Bootstrap supports a handful of media queries in a single file to help make your projects more appropriate on different devices and screen resolutions. Here's what's included:{{/i}}</p>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>{{_i}}Label{{/i}}</th>
<th>{{_i}}Layout width{{/i}}</th>
<th>{{_i}}Column width{{/i}}</th>
<th>{{_i}}Gutter width{{/i}}</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{_i}}Smartphones{{/i}}</td>
<td>480px and below</td>
<td class="muted" colspan="2">{{_i}}Fluid columns, no fixed widths{{/i}}</td>
</tr>
<tr>
<td>{{_i}}Smartphones to tablets{{/i}}</td>
<td>767px and below</td>
<td class="muted" colspan="2">{{_i}}Fluid columns, no fixed widths{{/i}}</td>
</tr>
<tr>
<td>{{_i}}Portrait tablets{{/i}}</td>
<td>768px and above</td>
<td>42px</td>
<td>20px</td>
</tr>
<tr>
<td>{{_i}}Default{{/i}}</td>
<td>980px and up</td>
<td>60px</td>
<td>20px</td>
</tr>
<tr>
<td>{{_i}}Large display{{/i}}</td>
<td>1200px and up</td>
<td>70px</td>
<td>30px</td>
</tr>
</tbody>
</table>
<h3>{{_i}}Requires meta tag{{/i}}</h3>
<p>{{_i}}To ensure devices display responsive pages properly, include the viewport meta tag.{{/i}}</p>
<pre class="prettyprint linenums"><meta name="viewport" content="width=device-width, initial-scale=1.0"></pre>
</div><!-- /.span -->
</div><!-- /.row -->
<br>
<!-- Media query code -->
<h2>{{_i}}Using the media queries{{/i}}</h2>
<div class="row">
<div class="span4">
<p>{{_i}}Bootstrap doesn't automatically include these media queries, but understanding and adding them is very easy and requires minimal setup. You have a few options for including the responsive features of Bootstrap:{{/i}}</p>
<ol>
<li>{{_i}}Use the compiled responsive version, bootstrap-responsive.css{{/i}}</li>
<li>{{_i}}Add @import "responsive.less" and recompile Bootstrap{{/i}}</li>
<li>{{_i}}Modify and recompile responsive.less as a separate file{{/i}}</li>
</ol>
<p>{{_i}}<strong>Why not just include it?</strong> Truth be told, not everything needs to be responsive. Instead of encouraging developers to remove this feature, we figure it best to enable it.{{/i}}</p>
</div><!-- /.span -->
<div class="span8">
<pre class="prettyprint linenums">
/* {{_i}}Landscape phones and down{{/i}} */
@media (max-width: 480px) { ... }
/* {{_i}}Landscape phone to portrait tablet{{/i}} */
@media (max-width: 767px) { ... }
/* {{_i}}Portrait tablet to landscape and desktop{{/i}} */
@media (min-width: 768px) and (max-width: 979px) { ... }
/* {{_i}}Large desktop{{/i}} */
@media (min-width: 1200px) { ... }
</pre>
</div><!-- /.span -->
</div><!-- /.row -->
<br>
<!-- Responsive utility classes -->
<h2>{{_i}}Responsive utility classes{{/i}}</h2>
<div class="row">
<div class="span4">
<h3>{{_i}}What are they{{/i}}</h2>
<p>{{_i}}For faster mobile-friendly development, use these basic utility classes for showing and hiding content by device.{{/i}}</p>
<h3>{{_i}}When to use{{/i}}</h2>
<p>{{_i}}Use on a limited basis and avoid creating entirely different versions of the same site. Instead, use them to complement each device's presentation.{{/i}}</p>
<p>{{_i}}For example, you might show a <code><select></code> element for nav on mobile layouts, but not on tablets or desktops.{{/i}}</p>
</div><!-- /.span -->
<div class="span8">
<h3>{{_i}}Support classes{{/i}}</h3>
<p>{{_i}}Shown here is a table of the classes we support and their effect on a given media query layout (labeled by device). They can be found in <code>responsive.less</code>.{{/i}}</p>
<table class="table table-bordered table-striped responsive-utilities">
<thead>
<tr>
<th>{{_i}}Class{{/i}}</th>
<th>{{_i}}Phones <small>480px and below</small>{{/i}}</th>
<th>{{_i}}Tablets <small>767px and below</small>{{/i}}</th>
<th>{{_i}}Desktops <small>768px and above</small>{{/i}}</th>
</tr>
</thead>
<tbody>
<tr>
<th><code>.visible-phone</code></th>
<td class="is-visible">{{_i}}Visible{{/i}}</td>
<td class="is-hidden">{{_i}}Hidden{{/i}}</td>
<td class="is-hidden">{{_i}}Hidden{{/i}}</td>
</tr>
<tr>
<th><code>.visible-tablet</code></th>
<td class="is-hidden">{{_i}}Hidden{{/i}}</td>
<td class="is-visible">{{_i}}Visible{{/i}}</td>
<td class="is-hidden">{{_i}}Hidden{{/i}}</td>
</tr>
<tr>
<th><code>.visible-desktop</code></th>
<td class="is-hidden">{{_i}}Hidden{{/i}}</td>
<td class="is-hidden">{{_i}}Hidden{{/i}}</td>
<td class="is-visible">{{_i}}Visible{{/i}}</td>
</tr>
<tr>
<th><code>.hidden-phone</code></th>
<td class="is-hidden">{{_i}}Hidden{{/i}}</td>
<td class="is-visible">{{_i}}Visible{{/i}}</td>
<td class="is-visible">{{_i}}Visible{{/i}}</td>
</tr>
<tr>
<th><code>.hidden-tablet</code></th>
<td class="is-visible">{{_i}}Visible{{/i}}</td>
<td class="is-hidden">{{_i}}Hidden{{/i}}</td>
<td class="is-visible">{{_i}}Visible{{/i}}</td>
</tr>
<tr>
<th><code>.hidden-desktop</code></th>
<td class="is-visible">{{_i}}Visible{{/i}}</td>
<td class="is-visible">{{_i}}Visible{{/i}}</td>
<td class="is-hidden">{{_i}}Hidden{{/i}}</td>
</tr>
</tbody>
</table>
<h3>{{_i}}Test case{{/i}}</h3>
<p>{{_i}}Resize your browser or load on different devices to test the above classes.{{/i}}</p>
<h4>{{_i}}Visible on...{{/i}}</h4>
<p>{{_i}}Green checkmarks indicate that class is visible in your current viewport.{{/i}}</p>
<ul class="responsive-utilities-test">
<li>{{_i}}Phone{{/i}}<span class="visible-phone">✔ {{_i}}Phone{{/i}}</span></li>
<li>{{_i}}Tablet{{/i}}<span class="visible-tablet">✔ {{_i}}Tablet{{/i}}</span></li>
<li>{{_i}}Desktop{{/i}}<span class="visible-desktop">✔ {{_i}}Desktop{{/i}}</span></li>
</ul>
<h4>{{_i}}Hidden on...{{/i}}</h4>
<p>{{_i}}Here, green checkmarks indicate that class is hidden in your current viewport.{{/i}}</p>
<ul class="responsive-utilities-test hidden-on">
<li>{{_i}}Phone{{/i}}<span class="hidden-phone">✔ {{_i}}Phone{{/i}}</span></li>
<li>{{_i}}Tablet{{/i}}<span class="hidden-tablet">✔ {{_i}}Tablet{{/i}}</span></li>
<li>{{_i}}Desktop{{/i}}<span class="hidden-desktop">✔ {{_i}}Desktop{{/i}}</span></li>
</ul>
</div><!-- /.span -->
</div><!-- /.row -->
<div class="row">
<div class="span4">
</div><!-- /.span -->
</div><!-- /.row -->
</section>
|