scaffolding.html 23.4 KB
Newer Older
1
2
3
4
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
5
    <title>Scaffolding · Twitter Bootstrap</title>
Raul Riera's avatar
Raul Riera committed
6
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
8
9
10
    <meta name="description" content="">
    <meta name="author" content="">

    <!-- Le styles -->
11
12
    <link href="assets/css/bootstrap.css" rel="stylesheet">
    <link href="assets/css/bootstrap-responsive.css" rel="stylesheet">
13
14
15
    <link href="assets/css/docs.css" rel="stylesheet">
    <link href="assets/js/google-code-prettify/prettify.css" rel="stylesheet">

Mark Otto's avatar
Mark Otto committed
16
17
18
19
20
    <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
      <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->

21
    <!-- Le fav and touch icons -->
Mark Otto's avatar
Mark Otto committed
22
    <link rel="shortcut icon" href="assets/ico/favicon.ico">
Mark Otto's avatar
Mark Otto committed
23
    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="assets/ico/apple-touch-icon-144-precomposed.png">
24
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="assets/ico/apple-touch-icon-114-precomposed.png">
25
26
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="assets/ico/apple-touch-icon-72-precomposed.png">
    <link rel="apple-touch-icon-precomposed" href="assets/ico/apple-touch-icon-57-precomposed.png">
27

28
29
  </head>

Mark Otto's avatar
Mark Otto committed
30
  <body data-spy="scroll" data-target=".subnav" data-offset="50">
31

Mark Otto's avatar
Mark Otto committed
32
33
34
35
    <!-- Navbar
    ================================================== -->
    <div class="navbar navbar-fixed-top">
      <div class="navbar-inner">
Mark Otto's avatar
Mark Otto committed
36
        <div class="bs-docs-container">
Purwandi's avatar
Purwandi committed
37
          <button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
Mark Otto's avatar
Mark Otto committed
38
39
40
41
42
43
44
45
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="brand" href="./index.html">Bootstrap</a>
          <div class="nav-collapse collapse">
            <ul class="nav">
              <li class="">
Mark Otto's avatar
Mark Otto committed
46
                <a href="./index.html">Home</a>
Mark Otto's avatar
Mark Otto committed
47
48
49
50
51
52
53
54
55
56
57
              </li>
              <li class="active">
                <a href="./scaffolding.html">Scaffolding</a>
              </li>
              <li class="">
                <a href="./base-css.html">Base CSS</a>
              </li>
              <li class="">
                <a href="./components.html">Components</a>
              </li>
              <li class="">
Mark Otto's avatar
Mark Otto committed
58
                <a href="./javascript.html">Javascript</a>
Mark Otto's avatar
Mark Otto committed
59
60
              </li>
              <li class="">
Mark Otto's avatar
Mark Otto committed
61
                <a href="./less.html">LESS</a>
Mark Otto's avatar
Mark Otto committed
62
63
64
65
66
67
68
69
70
71
72
73
74
75
              </li>
              <li class="divider-vertical"></li>
              <li class="">
                <a href="./download.html">Customize</a>
              </li>
              <li class="">
                <a href="./examples.html">Examples</a>
              </li>
            </ul>
          </div>
        </div>
      </div>
    </div>

76
77
78
79
80
81
82
    <div class="bs-docs-container">

<!-- Masthead
================================================== -->
<header class="jumbotron subhead" id="overview">
  <h1>Scaffolding</h1>
  <p class="lead">Bootstrap is built on a responsive 12-column grid. We've also included fixed- and fluid-width layouts based on that system.</p>
Mark Otto's avatar
Mark Otto committed
83
  <div class="subnav">
84
    <ul class="nav">
Mark Otto's avatar
Mark Otto committed
85
86
87
88
89
90
91
92
      <li><a href="#global">Global styles</a></li>
      <li><a href="#gridSystem">Grid system</a></li>
      <li><a href="#fluidGridSystem">Fluid grid system</a></li>
      <li><a href="#gridCustomization">Customizing</a></li>
      <li><a href="#layouts">Layouts</a></li>
      <li><a href="#responsive">Responsive design</a></li>
    </ul>
  </div>
93
94
95
</header>


96
97
98
99
100
101
102

<!-- Global Bootstrap settings
================================================== -->
<section id="global">
  <div class="page-header">
    <h1>Global styles <small>for CSS reset, typography, and links</small></h1>
  </div>
103
104

  <h2>Requires HTML5 doctype</h2>
Mark Otto's avatar
Mark Otto committed
105
  <p>Bootstrap makes use of certain HTML elements and CSS properties that require the use of the HTML5 doctype. Include it at the beginning of all your projects.</p>
106
107
108
109
110
111
<pre class="prettyprint linenums">
&lt;!DOCTYPE html&gt;
&lt;html lang="en"&gt;
  ...
&lt;/html&gt;
</pre>
112
113

  <h2>Typography and links</h2>
Mark Otto's avatar
Mark Otto committed
114
  <p>Bootstrap sets basic global display, typography, and link styles. Specifically, we:</p>
115
  <ul>
Mark Otto's avatar
Mark Otto committed
116
    <li>Remove <code>margin</code> on the body</li>
117
118
119
120
    <li>Set <code>background-color: white;</code> on the <code>body</code></li>
    <li>Use the <code>@baseFontFamily</code>, <code>@baseFontSize</code>, and <code>@baseLineHeight</code> attributes as our typographyic base</li>
    <li>Set the global link color via <code>@linkColor</code> and apply link underlines only on <code>:hover</code></li>
  </ul>
Mark Otto's avatar
Mark Otto committed
121
  <p>These styles can be found within <strong>scaffolding.less</strong>.</p>
122
123

  <h2>Reset via Normalize</h2>
Mark Otto's avatar
Mark Otto committed
124
  <p>With Bootstrap 2, the old reset block has been dropped in favor of <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>. While we use much of Normalize within our <strong>reset.less</strong>, we have removed some elements specifically for Bootstrap.</p>
125

126
127
128
129
130
</section>




131
132
<!-- Grid system
================================================== -->
133
<section id="gridSystem">
134
  <div class="page-header">
135
    <h1>Default grid system <small>12 columns with a responsive twist</small></h1>
136
137
  </div>

Mark Otto's avatar
Mark Otto committed
138
139
  <h2>Live grid example</h2>
  <p>The default Bootstrap grid system utilizes <strong>12 columns</strong>, making for a 940px wide container without <a href="#responsive">responsive features</a> enabled. With the responsive CSS file added, the grid adapts to be 724px and 1170px wide depending on your viewport. Below 767px viewports, the columns become fluid and stack vertically.</p>
140
141
142
143
144
145
146
147
148
149
150
151
152
153
  <div class="bs-docs-grid">
    <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>
    <div class="row show-grid">
Mark Otto's avatar
Mark Otto committed
154
      <div class="span2">2</div>
155
156
157
158
159
      <div class="span4">4</div>
      <div class="span4">4</div>
    </div>
    <div class="row show-grid">
      <div class="span4">4</div>
Mark Otto's avatar
Mark Otto committed
160
      <div class="span6">6</div>
161
162
    </div>
    <div class="row show-grid">
Mark Otto's avatar
Mark Otto committed
163
164
      <div class="span5">5</div>
      <div class="span5">5</div>
165
166
    </div>
    <div class="row show-grid">
Mark Otto's avatar
Mark Otto committed
167
      <div class="span10">10</div>
168
    </div>
169
  </div>
170

Mark Otto's avatar
Mark Otto committed
171
172
  <h3>Basic grid HTML</h3>
  <p>For a simple two column layout, create a <code>.row</code> and add the appropriate number of <code>.span*</code> columns. As this is a 12-column grid, each <code>.span*</code> spans a number of those 12 columns, and should always add up to 12 for each row.</p>
173
174
175
176
177
178
<pre class="prettyprint linenums">
&lt;div class="row"&gt;
  &lt;div class="span4"&gt;...&lt;/div&gt;
  &lt;div class="span8"&gt;...&lt;/div&gt;
&lt;/div&gt;
</pre>
Mark Otto's avatar
Mark Otto committed
179
  <p>Given this example, we have <code>.span4</code> and <code>.span8</code>, making for 12 total columns and a complete row.</p>
180

181
  <h2>Offsetting columns</h2>
Mark Otto's avatar
Mark Otto committed
182
  <p>Move columns to the left using <code>.offset*</code> classes. Each class increases the left margin of a column by a whole column. For example, <code>.offset4</code> moves <code>.span4</code> over four columns.</p>
183
184
185
  <div class="bs-docs-grid">
    <div class="row show-grid">
      <div class="span4">4</div>
Mark Otto's avatar
Mark Otto committed
186
      <div class="span4 offset2">4 offset 2</div>
187
188
    </div><!-- /row -->
    <div class="row show-grid">
Mark Otto's avatar
Mark Otto committed
189
190
      <div class="span3 offset2">3 offset 2</div>
      <div class="span3 offset2">3 offset 2</div>
191
192
    </div><!-- /row -->
    <div class="row show-grid">
Mark Otto's avatar
Mark Otto committed
193
      <div class="span6 offset4">6 offset 4</div>
194
195
    </div><!-- /row -->
  </div>
196
197
198
199
200
201
<pre class="prettyprint linenums">
&lt;div class="row"&gt;
  &lt;div class="span4"&gt;...&lt;/div&gt;
  &lt;div class="span4 offset4"&gt;...&lt;/div&gt;
&lt;/div&gt;
</pre>
202
203

  <h2>Nesting columns</h2>
Mark Otto's avatar
Mark Otto committed
204
205
206
207
    <p>To nest your content with the default grid, add a new <code>.row</code> and set of <code>.span*</code> columns within an existing <code>.span*</code> column. Nested rows should include a set of columns that add up to the number of columns of its parent.</p>
    <h3>Example</h3>
    <p>Here two nested <code>.span4</code> columns are placed within a <code>.span8</code>.</p>
    <div class="row show-grid">
Mark Otto's avatar
Mark Otto committed
208
      <div class="span10">
Mark Otto's avatar
Mark Otto committed
209
210
        Level 1 of column
        <div class="row show-grid">
Mark Otto's avatar
Mark Otto committed
211
          <div class="span5">
Mark Otto's avatar
Mark Otto committed
212
213
            Level 2
          </div>
Mark Otto's avatar
Mark Otto committed
214
          <div class="span5">
Mark Otto's avatar
Mark Otto committed
215
            Level 2
216
217
218
          </div>
        </div>
      </div>
Mark Otto's avatar
Mark Otto committed
219
    </div>
220
221
<pre class="prettyprint linenums">
&lt;div class="row"&gt;
Mark Otto's avatar
Mark Otto committed
222
  &lt;div class="span10"&gt;
223
    Level 1 column
224
    &lt;div class="row"&gt;
Mark Otto's avatar
Mark Otto committed
225
226
      &lt;div class="span5"&gt;Level 2&lt;/div&gt;
      &lt;div class="span5"&gt;Level 2&lt;/div&gt;
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
</pre>
</section>



<!-- Fluid grid system
================================================== -->
<section id="fluidGridSystem">
  <div class="page-header">
    <h1>Fluid grid system <small>12 responsive, percent-based columns</small></h1>
  </div>

Mark Otto's avatar
Mark Otto committed
242
243
  <h2>Live fluid grid example</h2>
  <p>The fluid grid system uses percents instead of pixels for column widths. It has the same responsive capabilities as our fixed grid system, ensuring proper proportions for key screen resolutions and devices.</p>
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
  <div class="bs-docs-grid">
    <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>
275
276
  </div>

Mark Otto's avatar
Mark Otto committed
277
278
  <h3>Basic fluid grid HTML</h3>
  <p>Make any row "fluid" by changing <code>.row</code> to <code>.row-fluid</code>. The column classes stay the exact same, making it easy to flip between fixed and fluid grids.</p>
279
280
281
282
283
<pre class="prettyprint linenums">
&lt;div class="row-fluid"&gt;
  &lt;div class="span4"&gt;...&lt;/div&gt;
  &lt;div class="span8"&gt;...&lt;/div&gt;
&lt;/div&gt;
Mark Otto's avatar
Mark Otto committed
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
</pre>

  <h2>Fluid offsetting</h2>
  <p>Operates the same way as the fixed grid system offsetting: add <code>.offset*</code> to any column to offset by that many columns.</p>
  <div class="bs-docs-grid">
    <div class="row-fluid show-grid">
      <div class="span4">4</div>
      <div class="span4 offset4">4 offset 4</div>
    </div><!-- /row -->
    <div class="row-fluid show-grid">
      <div class="span3 offset3">3 offset 3</div>
      <div class="span3 offset3">3 offset 3</div>
    </div><!-- /row -->
    <div class="row-fluid show-grid">
      <div class="span6 offset6">6 offset 6</div>
    </div><!-- /row -->
  </div>
<pre class="prettyprint linenums">
&lt;div class="row-fluid"&gt;
  &lt;div class="span4"&gt;...&lt;/div&gt;
  &lt;div class="span4 offset2"&gt;...&lt;/div&gt;
&lt;/div&gt;
306
307
308
</pre>

  <h2>Fluid nesting</h2>
Mark Otto's avatar
Mark Otto committed
309
  <p>Nesting with fluid grids is a bit different: the number of nested columns should not match the parent's number of columns. Instead, each level of nested columns are reset because each row takes up 100% of the parent column.</p>
310
311
312
  <div class="row-fluid show-grid">
    <div class="span12">
      Fluid 12
313
      <div class="row-fluid show-grid">
314
315
316
317
318
        <div class="span6">
          Fluid 6
        </div>
        <div class="span6">
          Fluid 6
319
320
        </div>
      </div>
321
322
    </div>
  </div>
323
<pre class="prettyprint linenums">
324
&lt;div class="row-fluid"&gt;
325
326
  &lt;div class="span12"&gt;
    Level 1 of column
327
    &lt;div class="row-fluid"&gt;
328
329
330
331
332
333
334
      &lt;div class="span6"&gt;Level 2&lt;/div&gt;
      &lt;div class="span6"&gt;Level 2&lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
</pre>

335
336
337
338
339
340
341
342
343
344
</section>



<!-- Customizaton
================================================== -->
<section id="gridCustomization">
  <div class="page-header">
    <h1>Grid customization</h1>
  </div>
Mark Otto's avatar
Mark Otto committed
345
346
347

  <h2>Variables in LESS</h2>
  <p>The default grid is built on a few variables for easy customization via LESS. All variables can be found in <strong>variables.less</strong>.</p>
348
  <table class="table table-bordered table-striped">
349
350
351
352
353
354
355
356
357
358
    <thead>
      <tr>
        <th>Variable</th>
        <th>Default value</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><code>@gridColumns</code></td>
359
        <td>12</td>
Mark Otto's avatar
Mark Otto committed
360
        <td>Number of columns</td>
361
362
363
      </tr>
      <tr>
        <td><code>@gridColumnWidth</code></td>
364
        <td>60px</td>
Mark Otto's avatar
Mark Otto committed
365
        <td>Width of each column</td>
366
367
368
369
      </tr>
      <tr>
        <td><code>@gridGutterWidth</code></td>
        <td>20px</td>
Mark Otto's avatar
Mark Otto committed
370
        <td>Negative space between columns</td>
371
      </tr>
Mark Otto's avatar
Mark Otto committed
372
373
374
375
376
377
378
379
380
381
      <tr>
        <td><code>@fluidGridColumnWidth</code></td>
        <td>6.382978723%</td>
        <td>Width of each fluid column</td>
      </tr>
      <tr>
        <td><code>@fluidGridGutterWidth</code></td>
        <td>2.127659574%</td>
        <td>Negative space between fluid columns</td>
      </tr>
382
383
    </tbody>
  </table>
384
385

  <h3>How to customize</h3>
Mark Otto's avatar
Mark Otto committed
386
  <p>Modifying the grid means changing the three <code>@grid*</code> variables and recompiling Bootstrap. Change the grid variables in <strong>variables.less</strong> 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 <strong>grid.less</strong>.</p>
387

Mark Otto's avatar
Mark Otto committed
388
389
  <h2>Staying responsive</h2>
  <p>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 manually customize the grids in <strong>responsive.less</strong> until a future update improves this.</p>
390
391
392
393
394
395
396
397
398
399
400
401

</section>



<!-- Layouts (Default and fluid)
================================================== -->
<section id="layouts">
  <div class="page-header">
    <h1>Layouts <small>Basic templates to create webpages</small></h1>
  </div>

402
  <h2>Fixed layout</h2>
Mark Otto's avatar
Mark Otto committed
403
  <p>Provides a common fixed-width (and optionally responsive) layout with only <code>&lt;div class="container"&gt;</code> required.</p>
404
405
406
  <div class="mini-layout">
    <div class="mini-layout-body"></div>
  </div>
407
408
409
410
411
412
413
<pre class="prettyprint linenums">
&lt;body&gt;
  &lt;div class="container"&gt;
    ...
  &lt;/div&gt;
&lt;/body&gt;
</pre>
414
415

  <h2>Fluid layout</h2>
Mark Otto's avatar
Mark Otto committed
416
  <p>Create a fluid, two-column page with <code>&lt;div class="container-fluid"&gt;</code>&mdash;great for applications and docs.</p>
417
418
419
420
  <div class="mini-layout fluid">
    <div class="mini-layout-sidebar"></div>
    <div class="mini-layout-body"></div>
  </div>
421
<pre class="prettyprint linenums">
Mark Otto's avatar
Mark Otto committed
422
423
424
425
&lt;div class="container-fluid"&gt;
  &lt;div class="row-fluid"&gt;
    &lt;div class="span2"&gt;
      &lt;!--Sidebar content--&gt;
426
    &lt;/div&gt;
Mark Otto's avatar
Mark Otto committed
427
428
    &lt;div class="span10"&gt;
      &lt;!--Body content--&gt;
429
430
    &lt;/div&gt;
  &lt;/div&gt;
Mark Otto's avatar
Mark Otto committed
431
&lt;/div&gt;
432
433
434
435
436
437
438
439
440
441
442
443
</pre>
</section>




<!-- Responsive design
================================================== -->
<section id="responsive">
  <div class="page-header">
    <h1>Responsive design <small>Media queries for various devices and resolutions</small></h1>
  </div>
444

Mark Otto's avatar
Mark Otto committed
445
446
447
448
449
450
451
452
453
454
  <h2>Enabling responsive features</h2>
  <p>Turn on responsive CSS in your project by including the proper meta tag and additional stylesheet within the <code>&lt;head&gt;</code> of your document. If you've compiled Bootstrap from the Customize page, you need only include the meta tag.</p>
<pre class="prettyprint linenums">
&lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt;
&lt;link href="assets/css/bootstrap-responsive.css" rel="stylesheet"&gt;
</pre>
  <p><span class="label label-info">Heads up!</span>  Bootstrap doesn't include responsive features by default at this time as not everything needs to be responsive. Instead of encouraging developers to remove this feature, we figure it best to enable it as needed.</p>

  <h2>About responsive Bootstrap</h2>
  <img src="assets/img/responsive-illustrations.png" alt="Responsive devices" style="float: right; margin: 0 0 20px 20px;">
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
  <p>Media queries allow for custom CSS based on a number of conditions&mdash;ratios, widths, display type, etc&mdash;but usually focuses around <code>min-width</code> and <code>max-width</code>.</p>
  <ul>
    <li>Modify the width of column in our grid</li>
    <li>Stack elements instead of float wherever necessary</li>
    <li>Resize headings and text to be more appropriate for devices</li>
  </ul>
  <p>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.</p>

  <h2>Supported devices</h2>
  <p>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:</p>
  <table class="table table-bordered table-striped">
    <thead>
      <tr>
        <th>Label</th>
        <th>Layout width</th>
        <th>Column width</th>
        <th>Gutter width</th>
      </tr>
    </thead>
    <tbody>
      <tr>
476
        <td>Phones</td>
477
478
479
480
        <td>480px and below</td>
        <td class="muted" colspan="2">Fluid columns, no fixed widths</td>
      </tr>
      <tr>
481
        <td>Phones to tablets</td>
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
        <td>767px and below</td>
        <td class="muted" colspan="2">Fluid columns, no fixed widths</td>
      </tr>
      <tr>
        <td>Portrait tablets</td>
        <td>768px and above</td>
        <td>42px</td>
        <td>20px</td>
      </tr>
      <tr>
        <td>Default</td>
        <td>980px and up</td>
        <td>60px</td>
        <td>20px</td>
      </tr>
      <tr>
        <td>Large display</td>
        <td>1200px and up</td>
        <td>70px</td>
        <td>30px</td>
      </tr>
    </tbody>
  </table>
505
<pre class="prettyprint linenums">
Mark Otto's avatar
Mark Otto committed
506
507
/* Landscape phones and down */
@media (max-width: 480px) { ... }
508

Mark Otto's avatar
Mark Otto committed
509
510
/* Landscape phone to portrait tablet */
@media (max-width: 767px) { ... }
511

Mark Otto's avatar
Mark Otto committed
512
513
/* Portrait tablet to landscape and desktop */
@media (min-width: 768px) and (max-width: 979px) { ... }
514

Mark Otto's avatar
Mark Otto committed
515
516
/* Large desktop */
@media (min-width: 1200px) { ... }
517
</pre>
518

519
520

  <h2>Responsive utility classes</h2>
Mark Otto's avatar
Mark Otto committed
521
  <p>For faster mobile-friendly development, use these utility classes for showing and hiding content by device. Below is a table of the available classes and their effect on a given media query layout (labeled by device). They can be found in <code>responsive.less</code>.</p>
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
556
557
558
559
560
561
562
563
564
565
566
567
568
569
  <table class="table table-bordered table-striped responsive-utilities">
    <thead>
      <tr>
        <th>Class</th>
        <th>Phones <small>480px and below</small></th>
        <th>Tablets <small>767px and below</small></th>
        <th>Desktops <small>768px and above</small></th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <th><code>.visible-phone</code></th>
        <td class="is-visible">Visible</td>
        <td class="is-hidden">Hidden</td>
        <td class="is-hidden">Hidden</td>
      </tr>
      <tr>
        <th><code>.visible-tablet</code></th>
        <td class="is-hidden">Hidden</td>
        <td class="is-visible">Visible</td>
        <td class="is-hidden">Hidden</td>
      </tr>
      <tr>
        <th><code>.visible-desktop</code></th>
        <td class="is-hidden">Hidden</td>
        <td class="is-hidden">Hidden</td>
        <td class="is-visible">Visible</td>
      </tr>
      <tr>
        <th><code>.hidden-phone</code></th>
        <td class="is-hidden">Hidden</td>
        <td class="is-visible">Visible</td>
        <td class="is-visible">Visible</td>
      </tr>
      <tr>
        <th><code>.hidden-tablet</code></th>
        <td class="is-visible">Visible</td>
        <td class="is-hidden">Hidden</td>
        <td class="is-visible">Visible</td>
      </tr>
      <tr>
        <th><code>.hidden-desktop</code></th>
        <td class="is-visible">Visible</td>
        <td class="is-visible">Visible</td>
        <td class="is-hidden">Hidden</td>
      </tr>
    </tbody>
  </table>
Mark Otto's avatar
Mark Otto committed
570
571
572
573
574

  <h3>When to use</h3>
  <p>Use on a limited basis and avoid creating entirely different versions of the same site. Instead, use them to complement each device's presentation.</p>

  <h3>Responsive utilities test case</h3>
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
  <p>Resize your browser or load on different devices to test the above classes.</p>
  <h4>Visible on...</h4>
  <p>Green checkmarks indicate that class is visible in your current viewport.</p>
  <ul class="responsive-utilities-test">
    <li>Phone<span class="visible-phone">&#10004; Phone</span></li>
    <li>Tablet<span class="visible-tablet">&#10004; Tablet</span></li>
    <li>Desktop<span class="visible-desktop">&#10004; Desktop</span></li>
  </ul>
  <h4>Hidden on...</h4>
  <p>Here, green checkmarks indicate that class is hidden in your current viewport.</p>
  <ul class="responsive-utilities-test hidden-on">
    <li>Phone<span class="hidden-phone">&#10004; Phone</span></li>
    <li>Tablet<span class="hidden-tablet">&#10004; Tablet</span></li>
    <li>Desktop<span class="hidden-desktop">&#10004; Desktop</span></li>
  </ul>
590

591
</section>
592

593

Jacob Thornton's avatar
Jacob Thornton committed
594
     <!-- Footer
595
596
      ================================================== -->
      <footer class="footer">
Mark Otto's avatar
Mark Otto committed
597
        <p class="pull-right"><a href="#">Back to top</a></p>
Mark Otto's avatar
Mark Otto committed
598
599
600
        <p>Designed and built with all the love in the world <a href="http://twitter.com/twitter" target="_blank">@twitter</a> by <a href="http://twitter.com/mdo" target="_blank">@mdo</a> and <a href="http://twitter.com/fat" target="_blank">@fat</a>.</p>
        <p>Code licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0" target="_blank">Apache License v2.0</a>. Documentation licensed under <a href="http://creativecommons.org/licenses/by/3.0/">CC BY 3.0</a>.</p>
        <p>Icons from <a href="http://glyphicons.com">Glyphicons Free</a>, licensed under <a href="http://creativecommons.org/licenses/by/3.0/">CC BY 3.0</a>.</p>
601
      </footer>
602

Mark Otto's avatar
Mark Otto committed
603
    </div>
604

605

606
607
608

    <!-- Le javascript
    ================================================== -->
609
    <!-- Placed at the end of the document so the pages load faster -->
610
    <script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
Jacob Thornton's avatar
Jacob Thornton committed
611
    <script src="assets/js/jquery.js"></script>
612
    <script src="assets/js/google-code-prettify/prettify.js"></script>
Jacob Thornton's avatar
Jacob Thornton committed
613
614
615
616
617
618
619
620
621
622
623
624
    <script src="assets/js/bootstrap-transition.js"></script>
    <script src="assets/js/bootstrap-alert.js"></script>
    <script src="assets/js/bootstrap-modal.js"></script>
    <script src="assets/js/bootstrap-dropdown.js"></script>
    <script src="assets/js/bootstrap-scrollspy.js"></script>
    <script src="assets/js/bootstrap-tab.js"></script>
    <script src="assets/js/bootstrap-tooltip.js"></script>
    <script src="assets/js/bootstrap-popover.js"></script>
    <script src="assets/js/bootstrap-button.js"></script>
    <script src="assets/js/bootstrap-collapse.js"></script>
    <script src="assets/js/bootstrap-carousel.js"></script>
    <script src="assets/js/bootstrap-typeahead.js"></script>
625
    <script src="assets/js/application.js"></script>
626
627


628
629
  </body>
</html>