diff options
Diffstat (limited to 'docs/scaffolding.html')
| -rw-r--r-- | docs/scaffolding.html | 881 |
1 files changed, 398 insertions, 483 deletions
diff --git a/docs/scaffolding.html b/docs/scaffolding.html index 4d6835caf..a8edd1705 100644 --- a/docs/scaffolding.html +++ b/docs/scaffolding.html @@ -27,15 +27,14 @@ </head> - <body data-spy="scroll" data-target=".subnav" data-offset="50"> + <body data-spy="scroll" data-target=".bs-docs-sidebar"> - - <!-- Navbar + <!-- Navbar ================================================== --> - <div class="navbar navbar-fixed-top"> + <div class="navbar navbar-inverse navbar-fixed-top"> <div class="navbar-inner"> <div class="container"> - <button type="button"class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> + <button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> @@ -44,7 +43,10 @@ <div class="nav-collapse collapse"> <ul class="nav"> <li class=""> - <a href="./index.html">Overview</a> + <a href="./index.html">Home</a> + </li> + <li class=""> + <a href="./getting-started.html">Get started</a> </li> <li class="active"> <a href="./scaffolding.html">Scaffolding</a> @@ -56,17 +58,10 @@ <a href="./components.html">Components</a> </li> <li class=""> - <a href="./javascript.html">Javascript plugins</a> - </li> - <li class=""> - <a href="./less.html">Using LESS</a> - </li> - <li class="divider-vertical"></li> - <li class=""> - <a href="./download.html">Customize</a> + <a href="./javascript.html">Javascript</a> </li> <li class=""> - <a href="./examples.html">Examples</a> + <a href="./customize.html">Customize</a> </li> </ul> </div> @@ -74,259 +69,254 @@ </div> </div> - <div class="container"> - -<!-- Masthead +<!-- Subhead ================================================== --> <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> - <div class="subnav"> - <ul class="nav nav-pills"> - <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 class="container"> + <h1>Scaffolding</h1> + <p class="lead">Bootstrap is built on responsive 12-column grids, layouts, and components.</p> </div> </header> + <div class="container"> + + <!-- Docs nav + ================================================== --> + <div class="row"> + <div class="span3 bs-docs-sidebar"> + <ul class="nav nav-list bs-docs-sidenav"> + <li><a href="#global"><i class="icon-chevron-right"></i> Global styles</a></li> + <li><a href="#gridSystem"><i class="icon-chevron-right"></i> Grid system</a></li> + <li><a href="#fluidGridSystem"><i class="icon-chevron-right"></i> Fluid grid system</a></li> + <li><a href="#layouts"><i class="icon-chevron-right"></i> Layouts</a></li> + <li><a href="#responsive"><i class="icon-chevron-right"></i> Responsive design</a></li> + </ul> + </div> + <div class="span9"> -<!-- Global Bootstrap settings -================================================== --> -<section id="global"> - <div class="page-header"> - <h1>Global styles <small>for CSS reset, typography, and links</small></h1> - </div> - <div class="row"> - <div class="span4"> - <h2>Requires HTML5 doctype</h2> - <p>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.</p> + <!-- Global Bootstrap settings + ================================================== --> + <section id="global"> + <div class="page-header"> + <h1>Global settings</h1> + </div> + + <h3>Requires HTML5 doctype</h3> + <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> <pre class="prettyprint linenums"> <!DOCTYPE html> <html lang="en"> ... </html> </pre> - </div><!-- /.span --> - <div class="span4"> - <h2>Typography and links</h2> - <p>Within the <strong>scaffolding.less</strong> file, we set basic global display, typography, and link styles. Specifically, we:</p> - <ul> - <li>Remove margin on the body</li> - <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> - </div><!-- /.span --> - <div class="span4"> - <h2>Reset via Normalize</h2> - <p>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>.</p> - <p>The new reset can still be found in <strong>reset.less</strong>, but with many elements removed for brevity and accuracy.</p> - </div><!-- /.span --> - </div><!-- /.row --> -</section> - - - - -<!-- Grid system -================================================== --> -<section id="gridSystem"> - <div class="page-header"> - <h1>Default grid system <small>12 columns with a responsive twist</small></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>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. </p> - </div><!-- /.span --> - <div class="span4"> + <h3>Typography and links</h3> + <p>Bootstrap sets basic global display, typography, and link styles. Specifically, we:</p> + <ul> + <li>Remove <code>margin</code> on the body</li> + <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> + <p>These styles can be found within <strong>scaffolding.less</strong>.</p> + + <h3>Reset via Normalize</h3> + <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> + + </section> + + + + + <!-- Grid system + ================================================== --> + <section id="gridSystem"> + <div class="page-header"> + <h1>Default grid system</h1> + </div> + + <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> + <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> + <div class="row show-grid"> + <div class="span2">2</div> + <div class="span3">3</div> + <div class="span4">4</div> + </div> + <div class="row show-grid"> + <div class="span4">4</div> + <div class="span5">5</div> + </div> + <div class="row show-grid"> + <div class="span9">9</div> + </div> + </div> + + <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 (or the number of columns in the parent).</p> <pre class="prettyprint linenums"> <div class="row"> <div class="span4">...</div> <div class="span8">...</div> </div> </pre> - </div><!-- /.span --> - <div class="span4"> - <p>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.</p> - </div><!-- /.span --> - </div><!-- /.row --> - - <br> - - <h2>Offsetting columns</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 --> + <p>Given this example, we have <code>.span4</code> and <code>.span8</code>, making for 12 total columns and a complete row.</p> + + <h2>Offsetting columns</h2> + <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> + <div class="bs-docs-grid"> + <div class="row show-grid"> + <div class="span4">4</div> + <div class="span3 offset2">3 offset 2</div> + </div><!-- /row --> + <div class="row show-grid"> + <div class="span3 offset1">3 offset 1</div> + <div class="span3 offset2">3 offset 2</div> + </div><!-- /row --> + <div class="row show-grid"> + <div class="span6 offset3">6 offset 3</div> + </div><!-- /row --> + </div> <pre class="prettyprint linenums"> <div class="row"> <div class="span4">...</div> - <div class="span4 offset4">...</div> + <div class="span3 offset2">...</div> </div> </pre> - <br> - - <h2>Nesting columns</h2> - <div class="row"> - <div class="span6"> - <p>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.</p> - <h3>Example</h3> - <p>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>.</p> - <div class="row show-grid"> - <div class="span6"> - Level 1 of column + <h2>Nesting columns</h2> + <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"> - <div class="span3"> - Level 2 - </div> - <div class="span3"> - Level 2 + <div class="span9"> + Level 1 of column + <div class="row show-grid"> + <div class="span6"> + Level 2 + </div> + <div class="span3"> + Level 2 + </div> + </div> </div> </div> - </div> - </div> - </div><!-- /.span --> - <div class="span6"> <pre class="prettyprint linenums"> <div class="row"> - <div class="span6"> + <div class="span9"> Level 1 column <div class="row"> - <div class="span3">Level 2</div> + <div class="span6">Level 2</div> <div class="span3">Level 2</div> </div> </div> </div> </pre> - </div><!-- /.span --> - </div><!-- /.row --> -</section> + </section> -<!-- Fluid grid system -================================================== --> -<section id="fluidGridSystem"> - <div class="page-header"> - <h1>Fluid grid system <small>12 responsive, percent-based columns</small></h1> - </div> + <!-- Fluid grid system + ================================================== --> + <section id="fluidGridSystem"> + <div class="page-header"> + <h1>Fluid grid system</h1> + </div> - <h2>Fluid columns</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> + <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> + <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> + </div> - <div class="row"> - <div class="span4"> - <h3>Percents, not pixels</h3> - <p>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.</p> - </div><!-- /.span --> - <div class="span4"> - <h3>Fluid rows</h3> - <p>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.</p> - </div><!-- /.span --> - <div class="span4"> - <h3>Markup</h3> + <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> <pre class="prettyprint linenums"> <div class="row-fluid"> <div class="span4">...</div> <div class="span8">...</div> </div> </pre> - </div><!-- /.span --> - </div><!-- /.row --> - - <h2>Fluid nesting</h2> - <div class="row"> - <div class="span6"> - <p>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.</p> - <div class="row-fluid show-grid"> - <div class="span12"> - Fluid 12 + + <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"> +<div class="row-fluid"> + <div class="span4">...</div> + <div class="span4 offset2">...</div> +</div> +</pre> + + <h2>Fluid nesting</h2> + <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> <div class="row-fluid show-grid"> - <div class="span6"> - Fluid 6 - </div> - <div class="span6"> - Fluid 6 + <div class="span12"> + Fluid 12 + <div class="row-fluid show-grid"> + <div class="span6"> + Fluid 6 + </div> + <div class="span6"> + Fluid 6 + </div> + </div> </div> </div> - </div> - </div> - </div><!-- /.span --> - <div class="span6"> <pre class="prettyprint linenums"> <div class="row-fluid"> <div class="span12"> @@ -338,78 +328,24 @@ </div> </div> </pre> - </div><!-- /.span --> - </div><!-- /.row --> -</section> + </section> -<!-- Customizaton -================================================== --> -<section id="gridCustomization"> - <div class="page-header"> - <h1>Grid customization</h1> - </div> - <table class="table table-bordered table-striped"> - <thead> - <tr> - <th>Variable</th> - <th>Default value</th> - <th>Description</th> - </tr> - </thead> - <tbody> - <tr> - <td><code>@gridColumns</code></td> - <td>12</td> - <td>Number of columns</td> - </tr> - <tr> - <td><code>@gridColumnWidth</code></td> - <td>60px</td> - <td>Width of each column</td> - </tr> - <tr> - <td><code>@gridGutterWidth</code></td> - <td>20px</td> - <td>Negative space between columns</td> - </tr> - </tbody> - </table> - <div class="row"> - <div class="span4"> - <h3>Variables in LESS</h3> - <p>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.</p> - </div><!-- /.span --> - <div class="span4"> - <h3>How to customize</h3> - <p>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.</p> - </div><!-- /.span --> - <div class="span4"> - <h3>Staying responsive</h3> - <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 customize the grids in responsive.less.</p> - </div><!-- /.span --> - </div><!-- /.row --> - -</section> - - - -<!-- Layouts (Default and fluid) -================================================== --> -<section id="layouts"> - <div class="page-header"> - <h1>Layouts <small>Basic templates to create webpages</small></h1> - </div> - <div class="row"> - <div class="span6"> - <h2>Fixed layout</h2> - <p>The default and simple 940px-wide, centered layout for just about any website or page provided by a single <code><div class="container"></code>.</p> - <div class="mini-layout"> - <div class="mini-layout-body"></div> - </div> + <!-- Layouts (Default and fluid) + ================================================== --> + <section id="layouts"> + <div class="page-header"> + <h1>Layouts</h1> + </div> + + <h2>Fixed layout</h2> + <p>Provides a common fixed-width (and optionally responsive) layout with only <code><div class="container"></code> required.</p> + <div class="mini-layout"> + <div class="mini-layout-body"></div> + </div> <pre class="prettyprint linenums"> <body> <div class="container"> @@ -417,14 +353,13 @@ </div> </body> </pre> - </div><!-- /.span --> - <div class="span6"> - <h2>Fluid layout</h2> - <p><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.</p> - <div class="mini-layout fluid"> - <div class="mini-layout-sidebar"></div> - <div class="mini-layout-body"></div> - </div> + + <h2>Fluid layout</h2> + <p>Create a fluid, two-column page with <code><div class="container-fluid"></code>—great for applications and docs.</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"> @@ -437,212 +372,190 @@ </div> </div> </pre> - </div><!-- /.span --> - </div><!-- /.row --> -</section> + </section> -<!-- Responsive design -================================================== --> -<section id="responsive"> - <div class="page-header"> - <h1>Responsive design <small>Media queries for various devices and resolutions</small></h1> - </div> - <!-- Supported devices --> - <div class="row"> - <div class="span4"> - <p><img src="assets/img/responsive-illustrations.png" alt="Responsive devices"></p> - <h3>What they do</h3> - <p>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>.</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> - </div><!-- /.span --> - <div class="span8"> - <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> - <td>Smartphones</td> - <td>480px and below</td> - <td class="muted" colspan="2">Fluid columns, no fixed widths</td> - </tr> - <tr> - <td>Smartphones to tablets</td> - <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> - - <h3>Requires meta tag</h3> - <p>To ensure devices display responsive pages properly, include the viewport meta tag.</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>Using the media queries</h2> - <div class="row"> - <div class="span4"> - <p>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:</p> - <ol> - <li>Use the compiled responsive version, bootstrap-responsive.css</li> - <li>Add @import "responsive.less" and recompile Bootstrap</li> - <li>Modify and recompile responsive.less as a separate file</li> - </ol> - <p><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.</p> - </div><!-- /.span --> - <div class="span8"> + <!-- Responsive design + ================================================== --> + <section id="responsive"> + <div class="page-header"> + <h1>Responsive design</h1> + </div> + + <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><head></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"> - /* Landscape phones and down */ - @media (max-width: 480px) { ... } +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<link href="assets/css/bootstrap-responsive.css" rel="stylesheet"> +</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;"> + <p>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>.</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> + <td>Phones</td> + <td>480px and below</td> + <td class="muted" colspan="2">Fluid columns, no fixed widths</td> + </tr> + <tr> + <td>Phones to tablets</td> + <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> +<pre class="prettyprint linenums"> +/* Landscape phones and down */ +@media (max-width: 480px) { ... } - /* Landscape phone to portrait tablet */ - @media (max-width: 767px) { ... } +/* Landscape phone to portrait tablet */ +@media (max-width: 767px) { ... } - /* Portrait tablet to landscape and desktop */ - @media (min-width: 768px) and (max-width: 979px) { ... } +/* Portrait tablet to landscape and desktop */ +@media (min-width: 768px) and (max-width: 979px) { ... } - /* Large desktop */ - @media (min-width: 1200px) { ... } +/* Large desktop */ +@media (min-width: 1200px) { ... } </pre> - </div><!-- /.span --> - </div><!-- /.row --> - <br> - - <!-- Responsive utility classes --> - <h2>Responsive utility classes</h2> - <div class="row"> - <div class="span4"> - <h3>What are they</h2> - <p>For faster mobile-friendly development, use these basic utility classes for showing and hiding content by device.</p> - <h3>When to use</h2> - <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> - <p>For example, you might show a <code><select></code> element for nav on mobile layouts, but not on tablets or desktops.</p> - </div><!-- /.span --> - <div class="span8"> - <h3>Support classes</h3> - <p>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>.</p> - <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> - <h3>Test case</h3> - <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">✔ Phone</span></li> - <li>Tablet<span class="visible-tablet">✔ Tablet</span></li> - <li>Desktop<span class="visible-desktop">✔ 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">✔ Phone</span></li> - <li>Tablet<span class="hidden-tablet">✔ Tablet</span></li> - <li>Desktop<span class="hidden-desktop">✔ Desktop</span></li> - </ul> - </div><!-- /.span --> - </div><!-- /.row --> - - - <div class="row"> - <div class="span4"> - </div><!-- /.span --> - </div><!-- /.row --> -</section> - - - <!-- Footer - ================================================== --> - <footer class="footer"> + + + <h2>Responsive utility classes</h2> + <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> + <table class="table table-bordered table-striped responsive-utilities"> + <thead> + <tr> + <th>Class</th> + <th>Phones <small>767px and below</small></th> + <th>Tablets <small>979px to 768px</small></th> + <th>Desktops <small>Default</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> + + <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> + <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">✔ Phone</span></li> + <li>Tablet<span class="visible-tablet">✔ Tablet</span></li> + <li>Desktop<span class="visible-desktop">✔ 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">✔ Phone</span></li> + <li>Tablet<span class="hidden-tablet">✔ Tablet</span></li> + <li>Desktop<span class="hidden-desktop">✔ Desktop</span></li> + </ul> + + </section> + + + + </div> + </div> + + </div> + + + + <!-- Footer + ================================================== --> + <footer class="footer"> + <div class="container"> <p class="pull-right"><a href="#">Back to top</a></p> <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> - </footer> - - </div><!-- /container --> + <ul class="footer-links"> + <li><a href="http://blog.getbootstrap.com">Read the blog</a></li> + <li><a href="https://github.com/twitter/bootstrap/issues?state=open">Submit issues</a></li> + <li><a href="https://github.com/twitter/bootstrap/wiki">Roadmap and changelog</a></li> + </ul> + </div> + </footer> @@ -664,8 +577,10 @@ <script src="assets/js/bootstrap-collapse.js"></script> <script src="assets/js/bootstrap-carousel.js"></script> <script src="assets/js/bootstrap-typeahead.js"></script> + <script src="assets/js/bootstrap-affix.js"></script> <script src="assets/js/application.js"></script> + </body> </html> |
