scaffolding.html 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Bootstrap, from Twitter</title>
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <meta name="description" content="">
  8. <meta name="author" content="">
  9. <!-- Le styles -->
  10. <link href="assets/css/bootstrap.css" rel="stylesheet">
  11. <link href="assets/css/bootstrap-responsive.css" rel="stylesheet">
  12. <link href="assets/css/docs.css" rel="stylesheet">
  13. <link href="assets/js/google-code-prettify/prettify.css" rel="stylesheet">
  14. <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
  15. <!--[if lt IE 9]>
  16. <script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
  17. <![endif]-->
  18. <!-- Le fav and touch icons -->
  19. <link rel="shortcut icon" href="assets/ico/favicon.ico">
  20. <link rel="apple-touch-icon" href="assets/ico/apple-touch-icon.png">
  21. <link rel="apple-touch-icon" sizes="72x72" href="assets/ico/apple-touch-icon-72x72.png">
  22. <link rel="apple-touch-icon" sizes="114x114" href="assets/ico/apple-touch-icon-114x114.png">
  23. </head>
  24. <body data-spy="scroll" data-target=".subnav" data-offset="50">
  25. <!-- Navbar
  26. ================================================== -->
  27. <div class="navbar navbar-fixed-top">
  28. <div class="navbar-inner">
  29. <div class="container">
  30. <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
  31. <span class="icon-bar"></span>
  32. <span class="icon-bar"></span>
  33. <span class="icon-bar"></span>
  34. </a>
  35. <a class="brand" href="./index.html">Bootstrap</a>
  36. <div class="nav-collapse">
  37. <ul class="nav">
  38. <li class="">
  39. <a href="./index.html">Overview</a>
  40. </li>
  41. <li class="active">
  42. <a href="./scaffolding.html">Scaffolding</a>
  43. </li>
  44. <li class="">
  45. <a href="./base-css.html">Base CSS</a>
  46. </li>
  47. <li class="">
  48. <a href="./components.html">Components</a>
  49. </li>
  50. <li class="">
  51. <a href="./javascript.html">Javascript plugins</a>
  52. </li>
  53. <li class="">
  54. <a href="./less.html">Using LESS</a>
  55. </li>
  56. <li class="divider-vertical"></li>
  57. <li class="">
  58. <a href="./download.html">Customize</a>
  59. </li>
  60. <li class="">
  61. <a href="./examples.html">Examples</a>
  62. </li>
  63. </ul>
  64. </div>
  65. </div>
  66. </div>
  67. </div>
  68. <div class="container">
  69. <!-- Masthead
  70. ================================================== -->
  71. <header class="jumbotron subhead" id="overview">
  72. <h1>Scaffolding</h1>
  73. <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>
  74. <div class="subnav">
  75. <ul class="nav nav-pills">
  76. <li><a href="#grid-system">Grid system</a></li>
  77. <li><a href="#layouts">Layouts</a></li>
  78. <li><a href="#responsive">Responsive design</a></li>
  79. </ul>
  80. </div>
  81. </header>
  82. <!-- Grid system
  83. ================================================== -->
  84. <section id="grid-system">
  85. <div class="page-header">
  86. <h1>Grid system <small>12 columns with a responsive twist</small></h1>
  87. </div>
  88. <h2>Default grid</h2>
  89. <div class="row show-grid">
  90. <div class="span1">1</div>
  91. <div class="span1">1</div>
  92. <div class="span1">1</div>
  93. <div class="span1">1</div>
  94. <div class="span1">1</div>
  95. <div class="span1">1</div>
  96. <div class="span1">1</div>
  97. <div class="span1">1</div>
  98. <div class="span1">1</div>
  99. <div class="span1">1</div>
  100. <div class="span1">1</div>
  101. <div class="span1">1</div>
  102. </div>
  103. <div class="row show-grid">
  104. <div class="span4">4</div>
  105. <div class="span4">4</div>
  106. <div class="span4">4</div>
  107. </div>
  108. <div class="row show-grid">
  109. <div class="span4">4</div>
  110. <div class="span8">8</div>
  111. </div>
  112. <div class="row show-grid">
  113. <div class="span6">6</div>
  114. <div class="span6">6</div>
  115. </div>
  116. <div class="row show-grid">
  117. <div class="span12">12</div>
  118. </div>
  119. <div class="row">
  120. <div class="span4">
  121. <p>The default grid system provided as part of Bootstrap is a <strong>940px-wide, 12-column grid</strong>.</p>
  122. <p>It also has four responsive variations for various devices and resolutions: phone, tablet portrait, table landscape and small desktops, and large widescreen desktops.</p>
  123. </div>
  124. <div class="span4">
  125. <pre class="prettyprint linenums">
  126. &lt;div class="row"&gt;
  127. &lt;div class="span4"&gt;...&lt;/div&gt;
  128. &lt;div class="span8"&gt;...&lt;/div&gt;
  129. &lt;/div&gt;
  130. </pre>
  131. </div>
  132. <div class="span4">
  133. <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>
  134. </div>
  135. </div><!-- /row -->
  136. <br>
  137. <h2>Offsetting columns</h2>
  138. <div class="row show-grid">
  139. <div class="span4">4</div>
  140. <div class="span4 offset4">4 offset 4</div>
  141. </div><!-- /row -->
  142. <div class="row show-grid">
  143. <div class="span3 offset3">3 offset 3</div>
  144. <div class="span3 offset3">3 offset 3</div>
  145. </div><!-- /row -->
  146. <div class="row show-grid">
  147. <div class="span8 offset4">8 offset 4</div>
  148. </div><!-- /row -->
  149. <pre class="prettyprint linenums">
  150. &lt;div class="row"&gt;
  151. &lt;div class="span4"&gt;...&lt;/div&gt;
  152. &lt;div class="span4 offset4"&gt;...&lt;/div&gt;
  153. &lt;/div&gt;
  154. </pre>
  155. <br>
  156. <h2>Nesting columns</h2>
  157. <div class="row">
  158. <div class="span6">
  159. <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>
  160. <h4>Example</h4>
  161. <div class="row show-grid">
  162. <div class="span6">
  163. Level 1 of column
  164. <div class="row show-grid">
  165. <div class="span3">
  166. Level 2
  167. </div>
  168. <div class="span3">
  169. Level 2
  170. </div>
  171. </div>
  172. </div>
  173. </div>
  174. </div>
  175. <div class="span6">
  176. <pre class="prettyprint linenums">
  177. &lt;div class="row"&gt;
  178. &lt;div class="span12"&gt;
  179. Level 1 of column
  180. &lt;div class="row"&gt;
  181. &lt;div class="span6"&gt;Level 2&lt;/div&gt;
  182. &lt;div class="span6"&gt;Level 2&lt;/div&gt;
  183. &lt;/div&gt;
  184. &lt;/div&gt;
  185. &lt;/div&gt;
  186. </pre>
  187. </div>
  188. </div>
  189. <h2>Grid customization</h2>
  190. <table class="table table-bordered table-striped">
  191. <thead>
  192. <tr>
  193. <th>Variable</th>
  194. <th>Default value</th>
  195. <th>Description</th>
  196. </tr>
  197. </thead>
  198. <tbody>
  199. <tr>
  200. <td><code>@gridColumns</code></td>
  201. <td>12</td>
  202. <td>Number of columns</td>
  203. </tr>
  204. <tr>
  205. <td><code>@gridColumnWidth</code></td>
  206. <td>60px</td>
  207. <td>Width of each column</td>
  208. </tr>
  209. <tr>
  210. <td><code>@gridGutterWidth</code></td>
  211. <td>20px</td>
  212. <td>Negative space between columns</td>
  213. </tr>
  214. <tr>
  215. <td><code>@siteWidth</code></td>
  216. <td><em>Computed sum of all columns and gutters</em></td>
  217. <td>Counts number of columns and gutters to set width of the <code>.container-fixed()</code> mixin</td>
  218. </tr>
  219. </tbody>
  220. </table>
  221. <div class="row">
  222. <div class="span4">
  223. <h3>Variables in LESS</h3>
  224. <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>
  225. </div>
  226. <div class="span4">
  227. <h3>How to customize</h3>
  228. <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>
  229. </div>
  230. <div class="span4">
  231. <h3>Staying responsive</h3>
  232. <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>
  233. </div>
  234. </div><!-- /row -->
  235. </section>
  236. <!-- Layouts (Default and fluid)
  237. ================================================== -->
  238. <section id="layouts">
  239. <div class="page-header">
  240. <h1>Layouts <small>Basic templates to create webpages</small></h1>
  241. </div>
  242. <div class="row">
  243. <div class="span6">
  244. <h2>Fixed layout</h2>
  245. <p>The default and simple 940px-wide, centered layout for just about any website or page provided by a single <code>&lt;div class="container"&gt;</code>.</p>
  246. <div class="minicon-layout">
  247. <div class="minicon-layout-body"></div>
  248. </div>
  249. <pre class="prettyprint linenums">
  250. &lt;body&gt;
  251. &lt;div class="container"&gt;
  252. ...
  253. &lt;/div&gt;
  254. &lt;/body&gt;
  255. </pre>
  256. </div><!-- /col -->
  257. <div class="span6">
  258. <h2>Fluid layout</h2>
  259. <p><code>&lt;div class="container-fluid"&gt;</code> gives flexible page structure, min- and max-widths, and a left-hand sidebar. It's great for apps and docs.</p>
  260. <div class="minicon-layout fluid">
  261. <div class="minicon-layout-sidebar"></div>
  262. <div class="minicon-layout-body"></div>
  263. </div>
  264. <pre class="prettyprint linenums">
  265. &lt;div class="container-fluid"&gt;
  266. &lt;div class="row-fluid"&gt;
  267. &lt;div class="span2"&gt;
  268. &lt;!--Sidebar content--&gt;
  269. &lt;/div&gt;
  270. &lt;div class="span10"&gt;
  271. &lt;!--Body content--&gt;
  272. &lt;/div&gt;
  273. &lt;/div&gt;
  274. &lt;/div&gt;
  275. </pre>
  276. </div><!-- /col -->
  277. </div><!-- /row -->
  278. </section>
  279. <!-- Responsive design
  280. ================================================== -->
  281. <section id="responsive">
  282. <div class="page-header">
  283. <h1>Responsive design <small>Media queries for various devices and resolutions</small></h1>
  284. </div>
  285. <!-- Supported devices -->
  286. <div class="row">
  287. <div class="span4">
  288. <img src="assets/img/responsive-illustrations.png" alt="Responsive devices">
  289. </div>
  290. <div class="span8">
  291. <h2>Supported devices</h2>
  292. <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>
  293. <table class="table table-bordered table-striped">
  294. <thead>
  295. <tr>
  296. <th>Label</th>
  297. <th>Layout width</th>
  298. <th>Column width</th>
  299. <th>Gutter width</th>
  300. </tr>
  301. </thead>
  302. <tbody>
  303. <tr>
  304. <td>Smartphones</td>
  305. <td>480px and below</td>
  306. <td class="muted" colspan="2">Fluid columns, no fixed widths</td>
  307. </tr>
  308. <tr>
  309. <td>Portrait tablets</td>
  310. <td>480px to 768px</td>
  311. <td class="muted" colspan="2">Fluid columns, no fixed widths</td>
  312. </tr>
  313. <tr>
  314. <td>Landscape tablets</td>
  315. <td>768px to 980px</td>
  316. <td>42px</td>
  317. <td>20px</td>
  318. </tr>
  319. <tr>
  320. <td>Default</td>
  321. <td>980px and up</td>
  322. <td>60px</td>
  323. <td>20px</td>
  324. </tr>
  325. <tr>
  326. <td>Large display</td>
  327. <td>1210px and up</td>
  328. <td>70px</td>
  329. <td>30px</td>
  330. </tr>
  331. </tbody>
  332. </table>
  333. <h3>Requires meta tag</h3>
  334. <p>To ensure devices display responsive pages properly, include the viewport meta tag.</p>
  335. <pre class="prettyprint linenums">&lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt;</pre>
  336. <h3>What they do</h3>
  337. <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>
  338. <ul>
  339. <li>Modify the width of column in our grid</li>
  340. <li>Stack elements instead of float wherever necessary</li>
  341. <li>Resize headings and text to be more appropriate for devices</li>
  342. </ul>
  343. </div>
  344. </div>
  345. <br>
  346. <!-- Media query code -->
  347. <h2>Using the media queries</h2>
  348. <div class="row">
  349. <div class="span5">
  350. <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>
  351. <ol>
  352. <li>Use the compiled responsive version, bootstrap-responsive.css</li>
  353. <li>Add @import "responsive.less" and recompile Bootstrap</li>
  354. <li>Modify and recompile responsive.less as a separate file</li>
  355. </ol>
  356. <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>
  357. </div>
  358. <div class="span7">
  359. <pre class="prettyprint linenums">
  360. // Landscape phones and down
  361. @media (max-width: 480px) { ... }
  362. // Landscape phone to portrait tablet
  363. @media (max-width: 768px) { ... }
  364. // Portrait tablet to landscape and desktop
  365. @media (min-width: 768px) and (max-width: 980px) { ... }
  366. // Large desktop
  367. @media (min-width: 1200px) { .. }
  368. </pre>
  369. </div>
  370. </div>
  371. </section>
  372. <!-- Footer
  373. ================================================== -->
  374. <footer class="footer">
  375. <p class="pull-right"><a href="#">Back to top</a></p>
  376. <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>
  377. <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>
  378. <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>
  379. </footer>
  380. </div><!-- /container -->
  381. <!-- Le javascript
  382. ================================================== -->
  383. <!-- Placed at the end of the document so the pages load faster -->
  384. <script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
  385. <script src="assets/js/jquery.js"></script>
  386. <script src="assets/js/google-code-prettify/prettify.js"></script>
  387. <script src="assets/js/bootstrap-transition.js"></script>
  388. <script src="assets/js/bootstrap-alert.js"></script>
  389. <script src="assets/js/bootstrap-modal.js"></script>
  390. <script src="assets/js/bootstrap-dropdown.js"></script>
  391. <script src="assets/js/bootstrap-scrollspy.js"></script>
  392. <script src="assets/js/bootstrap-tab.js"></script>
  393. <script src="assets/js/bootstrap-tooltip.js"></script>
  394. <script src="assets/js/bootstrap-popover.js"></script>
  395. <script src="assets/js/bootstrap-button.js"></script>
  396. <script src="assets/js/bootstrap-collapse.js"></script>
  397. <script src="assets/js/bootstrap-carousel.js"></script>
  398. <script src="assets/js/bootstrap-typeahead.js"></script>
  399. <script src="assets/js/application.js"></script>
  400. </body>
  401. </html>