385 lines
13 KiB
HTML
385 lines
13 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Bootstrap, from Twitter</title>
|
|
<meta name="description" content="">
|
|
<meta name="author" content="">
|
|
|
|
<!-- 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]-->
|
|
|
|
<!-- Le styles -->
|
|
<link href="../bootstrap.css" rel="stylesheet">
|
|
<link href="assets/css/docs.css" rel="stylesheet">
|
|
<link href="assets/js/google-code-prettify/prettify.css" rel="stylesheet">
|
|
|
|
<!-- Le fav and touch icons -->
|
|
<link rel="shortcut icon" type="image/x-icon" href="assets/ico/favicon.ico">
|
|
<link rel="apple-touch-icon" href="assets/ico/bootstrap-apple-57x57.png">
|
|
<link rel="apple-touch-icon" sizes="72x72" href="assets/ico/bootstrap-apple-72x72.png">
|
|
<link rel="apple-touch-icon" sizes="114x114" href="assets/ico/bootstrap-apple-114x114.png">
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<!-- Navbar
|
|
================================================== -->
|
|
<div class="navbar navbar-fixed">
|
|
<div class="navbar-inner">
|
|
<div class="container">
|
|
<a class="brand" href="./index.html">Bootstrap</a>
|
|
<ul class="nav">
|
|
<li><a href="./index.html">Overview</a></li>
|
|
<li class="active"><a href="./scaffolding.html">Scaffolding</a></li>
|
|
<li><a href="./base-css.html">Base CSS</a></li>
|
|
<li><a href="./components.html">Components</a></li>
|
|
<li><a href="./javascript.html">Javascript plugins</a></li>
|
|
<li><a href="./less.html">Using LESS</a></li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="container">
|
|
|
|
<!-- Masthead
|
|
================================================== -->
|
|
<header class="jumbotron subhead" id="overview">
|
|
<h1>Scaffolding</h1>
|
|
<p class="lead">Responsive 12-column grid and fixed- and fluid-width layouts</p>
|
|
</header>
|
|
|
|
|
|
|
|
<!-- Grid system
|
|
================================================== -->
|
|
<section id="grid-system">
|
|
<div class="page-header">
|
|
<h1>Grid system <small>12 columns with a responsive twist</small></h1>
|
|
</div>
|
|
|
|
<h2>Default 940px grid</h2>
|
|
<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 as part of Bootstrap is a <strong>940px-wide, 12-column grid</strong>.</p>
|
|
<p>It also has three responsive variations for various devices and resolutions: phone, tablet, and large widescreen desktops.</p>
|
|
</div>
|
|
<div class="span4">
|
|
<pre class="prettyprint linenums">
|
|
<div class="row">
|
|
<div class="span4">...</div>
|
|
<div class="span8">...</div>
|
|
</div>
|
|
</pre>
|
|
</div>
|
|
<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>
|
|
</div><!-- /row -->
|
|
|
|
<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 -->
|
|
|
|
<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>
|
|
<h4>Example</h4>
|
|
<div class="row show-grid">
|
|
<div class="span6">
|
|
Level 1 of column
|
|
<div class="row show-grid">
|
|
<div class="span3">
|
|
Level 2
|
|
</div>
|
|
<div class="span3">
|
|
Level 2
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="span6">
|
|
<pre class="prettyprint linenums">
|
|
<div class="row">
|
|
<div class="span12">
|
|
Level 1 of column
|
|
<div class="row">
|
|
<div class="span6">Level 2</div>
|
|
<div class="span6">Level 2</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
|
|
<h2>Grid customization</h2>
|
|
<table class="striped-table">
|
|
<thead>
|
|
<tr>
|
|
<th>Variable</th>
|
|
<th>Default value</th>
|
|
<th>Description</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td><code>@gridColumns</code></td>
|
|
<td>16</td>
|
|
<td>The number of columns within the grid</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>@gridColumnWidth</code></td>
|
|
<td>40px</td>
|
|
<td>The width of each column within the grid</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>@gridGutterWidth</code></td>
|
|
<td>20px</td>
|
|
<td>The negative space between each column</td>
|
|
</tr>
|
|
<tr>
|
|
<td><code>@siteWidth</code></td>
|
|
<td><em>Computed sum of all columns and gutters</em></td>
|
|
<td>We use some basic match to count the number of columns and gutters and set the width of the <code>.fixed-container()</code> mixin.</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 mixins.less.</p>
|
|
</div>
|
|
<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 grids in the preboot.less file and use one of the <a href="#compiling">four ways documented to recompile</a>.</p>
|
|
</div>
|
|
<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>
|
|
</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>
|
|
<pre class="prettyprint linenums">
|
|
<body>
|
|
<div class="container">
|
|
...
|
|
</div>
|
|
</body>
|
|
</pre>
|
|
</div><!-- /col -->
|
|
<div class="span6">
|
|
<h2>Fluid layout</h2>
|
|
<p><code><div class="fluid-container"></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>
|
|
<pre class="prettyprint linenums">
|
|
<body>
|
|
<div class="container-fluid">
|
|
<div class="sidebar">
|
|
...
|
|
</div>
|
|
<div class="content">
|
|
...
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</pre>
|
|
</div><!-- /col -->
|
|
</div><!-- /row -->
|
|
</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">
|
|
<img src="assets/img/responsive-illustrations.png" alt="Responsive devices">
|
|
</div>
|
|
<div class="span8">
|
|
<h2>Supported devices</h2>
|
|
<p>Bootstrap supports a handful of media queries to help make your projects more appropriate on different devices and screen resolutions. Here's what's included:</p>
|
|
<table class="striped-table">
|
|
<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>Portrait tablets</td>
|
|
<td>480px to 768px</td>
|
|
<td class="muted" colspan="2">Fluid columns, no fixed widths</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Landscape tablets</td>
|
|
<td>768px to 940px</td>
|
|
<td>44px</td>
|
|
<td>20px</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Default</td>
|
|
<td>940px and up</td>
|
|
<td>60px</td>
|
|
<td>20px</td>
|
|
</tr>
|
|
<tr>
|
|
<td>Large display</td>
|
|
<td>1210px and up</td>
|
|
<td>70px</td>
|
|
<td>30px</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
|
|
<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>
|
|
</div>
|
|
</div>
|
|
|
|
<br>
|
|
|
|
<!-- Media query code -->
|
|
<h2>Using the media queries</h2>
|
|
<div class="row">
|
|
<div class="span5">
|
|
<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.reponsive.css</li>
|
|
<li>Add @import "responsive.less" and recompile Bootstrap</li>
|
|
<li>Compile responsive.less as a separate file and include that</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>
|
|
<div class="span7">
|
|
<pre class="prettyprint linenums">
|
|
// Landscape phones and down
|
|
@media (max-width: 480px) { ... }
|
|
|
|
// Landscape phone to portrait tablet
|
|
@media (min-width: 480px) and (max-width: 768px) { ... }
|
|
|
|
// Portrait tablet to landscape and desktop
|
|
@media (min-width: 768px) and (max-width: 940px) { ... }
|
|
|
|
// Large desktop
|
|
@media (min-width: 1210px) { .. }
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
|
|
|
|
<!-- Footer
|
|
================================================== -->
|
|
<footer class="footer">
|
|
<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>.<br>
|
|
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>
|
|
</footer>
|
|
</div><!-- /container -->
|
|
|
|
<!-- Le javascript -->
|
|
<!-- Placed at the end of the document so the pages load faster -->
|
|
<script src="http://code.jquery.com/jquery-1.5.2.min.js"></script>
|
|
<script src="http://autobahn.tablesorter.com/jquery.tablesorter.min.js"></script>
|
|
<script src="assets/js/google-code-prettify/prettify.js"></script>
|
|
<script>$(function () { prettyPrint() })</script>
|
|
<script src="../js/bootstrap-transitions.js"></script>
|
|
<script src="../js/bootstrap-dropdown.js"></script>
|
|
<script src="../js/bootstrap-twipsy.js"></script>
|
|
<script src="../js/bootstrap-scrollspy.js"></script>
|
|
<script src="assets/js/application.js"></script>
|
|
</body>
|
|
</html>
|