<pclass="lead">Get the lowdown on the key pieces of Bootstrap's infrastructure, including our approach to better, faster, stronger web development.</p>
<h3>HTML5 doctype required</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>
{% highlight html %}
<!DOCTYPE html>
<htmllang="en">
...
</html>
{% endhighlight %}
<h3>Mobile first</h3>
<p>With Bootstrap 2, we added optional mobile friendly styles for key aspects of the framework. With Bootstrap 3, we've rewritten the project to be mobile friendly from the start. Instead of adding on optional mobile styles, they're baked right into the core. In fact, <strong>Bootstrap is mobile first</strong>. Mobile first styles can be found throughout the entire library instead of in separate files.</p>
<p>To ensure proper rendering and touch zooming, <strong>add the viewport meta tag</strong> to your <code><head></code>.</p>
<p>We automatically attempt to scale images to appropriate sizes with a global <code>max-width: 100%;</code> on all <code><img></code> elements. If you run into problems (e.g., with Google Maps), be sure to disable this property on a per-case basis.</p>
<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>@font-family-base</code>, <code>@font-size-base</code>, and <code>@line-height-base</code> attributes as our typographic base</li>
<li>Set the global link color via <code>@link-color</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>Normalize reset</h3>
<p>For improved cross-browser rendering, we use <ahref="http://necolas.github.com/normalize.css/"target="_blank">Normalize</a>, a project by <ahref="http://twitter.com/necolas"target="_blank">Nicolas Gallagher</a> and <ahref="http://twitter.com/jon_neal"target="_blank">Jonathan Neal</a>.</p>
<pclass="lead">Bootstrap includes a responsive, percent-based grid system that appropriately scales up to 12 columns as the device or viewport size increases—in other words, it's mobile first. It includes <ahref="#grid-example">predefined classes</a> for this, as well as powerful <ahref="#grid-less">mixins for generating semantic layouts</a>.</p>
<h3id="grid-example">Grid example</h3>
<p>On mobile devices, the grid starts out stacked. Above 768px, it becomes horizontal as media queries kick in to apply <code>float</code>s and <code>width</code>s. To create a basic grid layout, wrap a series of <code>.col-span-*</code> elements within a <code>.row</code>. As this is a 12-column grid, each <code>.col-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), even at mobile resolutions.</p>
<divclass="bs-docs-grid">
<divclass="row show-grid">
<divclass="col col-lg-1">1</div>
<divclass="col col-lg-1">1</div>
<divclass="col col-lg-1">1</div>
<divclass="col col-lg-1">1</div>
<divclass="col col-lg-1">1</div>
<divclass="col col-lg-1">1</div>
<divclass="col col-lg-1">1</div>
<divclass="col col-lg-1">1</div>
<divclass="col col-lg-1">1</div>
<divclass="col col-lg-1">1</div>
<divclass="col col-lg-1">1</div>
<divclass="col col-lg-1">1</div>
</div>
<divclass="row show-grid">
<divclass="col col-lg-4">4</div>
<divclass="col col-lg-4">4</div>
<divclass="col col-lg-4">4</div>
</div>
<divclass="row show-grid">
<divclass="col col-lg-6">6</div>
<divclass="col col-lg-6">6</div>
</div>
</div>
{% highlight html %}
<divclass="row">
<divclass="col col-lg-1">1</div>
<divclass="col col-lg-1">1</div>
<divclass="col col-lg-1">1</div>
<divclass="col col-lg-1">1</div>
<divclass="col col-lg-1">1</div>
<divclass="col col-lg-1">1</div>
<divclass="col col-lg-1">1</div>
<divclass="col col-lg-1">1</div>
<divclass="col col-lg-1">1</div>
<divclass="col col-lg-1">1</div>
<divclass="col col-lg-1">1</div>
<divclass="col col-lg-1">1</div>
</div>
<divclass="row">
<divclass="col col-lg-4">4</div>
<divclass="col col-lg-4">4</div>
<divclass="col col-lg-4">4</div>
</div>
<divclass="row">
<divclass="col col-lg-6">6</div>
<divclass="col col-lg-6">6</div>
</div>
{% endhighlight %}
<h3id="grid-offsetting">Offsetting columns</h3>
<p>Move columns to the right using <code>.col-offset-*</code> classes. These classes increase the left margin of a column by <code>*</code> columns. For example, <code>.col-offset-4</code> moves <code>.col col-lg-4</code> over four columns.</p>
<p>To nest your content with the default grid, add a new <code>.row</code> and set of <code>.col-span-*</code> columns within an existing <code>.col-span-*</code> column. Nested rows should include a set of columns that add up to 12.</p>
<divclass="row show-grid">
<divclass="col col-lg-9">
Level 1: 9 columns
<divclass="row show-grid">
<divclass="col col-lg-6">
Level 2: 6 columns
</div>
<divclass="col col-lg-6">
Level 2: 6 columns
</div>
</div>
</div>
</div>
{% highlight html %}
<divclass="row">
<divclass="col col-lg-9">
Level 1: 9 columns
<divclass="row">
<divclass="col col-lg-6">
Level 2: 6 columns
</div>
<divclass="col col-lg-6">
Level 2: 6 columns
</div>
</div>
</div>
</div>
{% endhighlight %}
<h3id="grid-column-ordering">Column ordering</h3>
<p>Easily change the order of our built-in grid columns with <code>.col-push-*</code> and <code>.col-pull-*</code> modifier classes.</p>
<divclass="row show-grid">
<divclass="col col-lg-9 col-push-3">9</div>
<divclass="col col-lg-3 col-pull-9">3</div>
</div>
{% highlight html %}
<divclass="row show-grid">
<divclass="col col-lg-9 col-push-3">9</div>
<divclass="col col-lg-3 col-pull-9">3</div>
</div>
{% endhighlight %}
<h3id="grid-small">Small device grid</h3>
<p>Use the small device grid classes, like <code>.col-sm-6</code>, to create columned layouts on phone and tablet devices (anything under 768px). Offsets, pushes, and pulls are not available with the small grid at this time.</p>
<divclass="row show-grid">
<divclass="col col-lg-4 col-sm-6">4 cols, 6 small cols</div>
<divclass="col col-lg-4 col-sm-6">4 cols, 6 small cols</div>
<divclass="col col-lg-4 col-sm-12">4 cols, 12 small cols</div>
</div>
{% highlight html %}
<divclass="row">
<divclass="col col-lg-4 col-sm-6">4 cols, 6 small cols</div>
<divclass="col col-lg-4 col-sm-6">4 cols, 6 small cols</div>
<divclass="col col-lg-4 col-sm-12">4 cols, 12 small cols</div>
</div>
{% endhighlight %}
<h3id="grid-less">LESS mixins and variables</h3>
<p>In addition to <ahref="#grid-example">prebuilt grid classes</a> for fast layouts, Bootstrap includes LESS variables and mixins for quickly generating your own simple, semantic layouts.</p>
<h4>Variables</h4>
<p>Variables determine the number of columns, the gutter width, and the media query point at which to begin floating columns. We use these to generate the predefined grid classes documented above, as well as for the custom mixins listed below.</p>
{% highlight css %}
@grid-columns: 12;
@grid-gutter-width: 30px;
@grid-float-breakpoint: 768px;
{% endhighlight %}
<h4>Mixins</h4>
<p>Mixins are used in conjunction with the grid variables to generate semantic CSS for individual grid columns.</p>
{% highlight css %}
// Creates a wrapper for a series of columns
.make-row() {
// Negative margin the row out to align the content of columns
margin-left: (@grid-gutter-width / -2);
margin-right: (@grid-gutter-width / -2);
// Then clear the floated columns
.clearfix();
}
// Generate the columns
.make-column(@columns) {
@media (min-width: @grid-float-breakpoint) {
float: left;
// Calculate width based on number of columns available
<p>You can modify the variables to your own custom values, or just use the mixins with their default values. Here's an example of using the default settings to create a two-column layout with a gap between.</p>
<p>Bootstrap's global default <code>font-size</code> is <strong>14px</strong>, with a <code>line-height</code> of <strong>20px</strong>. This is applied to the <code><body></code> and all paragraphs. In addition, <code><p></code> (paragraphs) receive a bottom margin of half their line-height (10px by default).</p>
<p>Nullam quis risus eget urna mollis ornare vel eu leo. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nullam id dolor id nibh ultricies vehicula.</p>
<p>Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec ullamcorper nulla non metus auctor fringilla. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Donec ullamcorper nulla non metus auctor fringilla.</p>
<p>Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit.</p>
</div>
{% highlight html %}
<p>...</p>
{% endhighlight %}
<!-- Body copy .lead -->
<h3>Lead body copy</h3>
<p>Make a paragraph stand out by adding <code>.lead</code>.</p>
<pclass="lead">Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Duis mollis, est non commodo luctus.</p>
</div>
{% highlight html %}
<pclass="lead">...</p>
{% endhighlight %}
<!-- Using LESS -->
<h3>Built with Less</h3>
<p>The typographic scale is based on two LESS variables in <strong>variables.less</strong>: <code>@font-size-base</code> and <code>@line-height-base</code>. The first is the base font-size used throughout and the second is the base line-height. We use those variables and some simple math to create the margins, paddings, and line-heights of all our type and more. Customize them and Bootstrap adapts.</p>
<!-- Emphasis -->
<h2id="type-emphasis">Emphasis</h2>
<p>Make use of HTML's default emphasis tags with lightweight styles.</p>
<h3>Small text</h3>
<p>For de-emphasizing inline or blocks of text, use the <code><small></code> tag to set text at 85% the size of the parent. Heading elements receive their own <code>font-size</code> for nested <code><small></code> elements.</p>
<p>The following snippet of text is <em>rendered as italicized text</em>.</p>
</div>
{% highlight html %}
<em>rendered as italicized text</em>
{% endhighlight %}
<p>Feel free to use <code><b></code> and <code><i></code> in HTML5. <code><b></code> is meant to highlight words or phrases without conveying additional importance while <code><i></code> is mostly for voice, technical terms, etc.</p>
<h3>Alignment classes</h3>
<p>Easily realign text to components with text alignment classes.</p>
<pclass="text-muted">Fusce dapibus, tellus ac cursus commodo, tortor mauris nibh.</p>
<pclass="text-warning">Etiam porta sem malesuada magna mollis euismod.</p>
<pclass="text-danger">Donec ullamcorper nulla non metus auctor fringilla.</p>
<pclass="text-success">Duis mollis, est non commodo luctus, nisi erat porttitor ligula.</p>
</div>
{% highlight html %}
<pclass="text-muted">...</p>
<pclass="text-warning">...</p>
<pclass="text-danger">...</p>
<pclass="text-success">...</p>
{% endhighlight %}
<!-- Abbreviations -->
<h2id="type-abbreviations">Abbreviations</h2>
<p>Stylized implementation of HTML's <code><abbr></code> element for abbreviations and acronyms to show the expanded version on hover. Abbreviations with a <code>title</code> attribute have a light dotted bottom border and a help cursor on hover, providing additional context on hover.</p>
<h3>Basic abbreviation</h3>
<p>For expanded text on long hover of an abbreviation, include the <code>title</code> attribute with the <code><abbr></code> element.</p>
<p>Present contact information for the nearest ancestor or the entire body of work. Preserve formatting by ending all lines with <code><br></code>.</p>
<p>For quoting blocks of content from another source within your document.</p>
<h3>Default blockquote</h3>
<p>Wrap <code><blockquote></code> around any <abbrtitle="HyperText Markup Language">HTML</abbr> as the quote. For straight quotes we recommend a <code><p></code>.</p>
<p>Remove the default <code>list-style</code> and left margin on list items (immediate children only). <strong>This only applies to immediate children list items</strong>, meaning you will need to add the class for any nested lists as well.</p>
<dd>A description list is perfect for defining terms.</dd>
<dt>Euismod</dt>
<dd>Vestibulum id ligula porta felis euismod semper eget lacinia odio sem nec elit.</dd>
<dd>Donec id elit non mi porta gravida at eget metus.</dd>
<dt>Malesuada porta</dt>
<dd>Etiam porta sem malesuada magna mollis euismod.</dd>
<dt>Felis euismod semper eget lacinia</dt>
<dd>Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.</dd>
</dl>
</div>
{% highlight html %}
<dlclass="dl-horizontal">
<dt>...</dt>
<dd>...</dd>
</dl>
{% endhighlight %}
<h5>Auto-truncating</h5>
<p>
Horizontal description lists will truncate terms that are too long to fit in the left column fix <code>text-overflow</code>. In narrower viewports, they will change to the default stacked layout.
<p>For basic styling—light padding and only horizontal dividers—add the base class <code>.table</code> to any <code><table></code>. It may seem super redundant, but given the widespread use of tables for other plugins like calendars and date pickers, we've opted to isolate our custom table styles.</p>
<p>Inputs, selects, and textareas are 100% wide by default in Bootstrap. To use the inline form, you'll have to set a width on the form controls used within.</p>
<p>Right align labels and float them to the left to make them appear on the same line as controls. Requires the most markup changes from a default form:</p>
<ul>
<li>Add <code>.form-horizontal</code> to the form</li>
<li>Wrap labels and controls in <code>.control-group</code></li>
<li>Add <code>.control-label</code> to the label</li>
<li>Wrap any associated controls in <code>.controls</code> for proper alignment</li>
<h2id="forms-controls">Supported form controls</h2>
<p>Examples of standard form controls supported in an example form layout.</p>
<h3>Inputs</h3>
<p>Most common form control, text-based input fields. Includes support for all HTML5 types: text, password, datetime, datetime-local, date, month, time, week, number, email, url, search, tel, and color.</p>
<h2id="forms-control-states">Form control states</h2>
<p>Provide feedback to users or visitors with basic feedback states on form controls and labels.</p>
<h3id="forms-input-focus">Input focus</h3>
<p>We remove the default <code>outline</code> styles on some form controls and apply a <code>box-shadow</code> in its place for <code>:focus</code>.</p>
<inputclass="focused"id="focusedInput"type="text"value="This is focused...">
</form>
{% highlight html %}
<inputid="focusedInput"type="text"value="This is focused...">
{% endhighlight %}
<h3id="forms-invalid-inputs">Invalid inputs</h3>
<p>Style inputs via default browser functionality. Specify a <code>type</code>, add the <code>required</code> attribute if the field is not optional, and (if applicable) specify a <code>pattern</code>.</p>
<p>Add the <code>disabled</code> attribute to a <code><fieldset></code> to disable all the controls within the <code><fieldset></code> at once.</p>
<h4>Link functionality of <code><a></code> not impacted</h4>
<p>This class will only change the appearance of <code><a class="btn"></code> buttons, not their functionality. Use custom JavaScript to disable links here.</p>
<p>While Bootstrap will apply these styles in all browsers, IE and Safari don't actually support the <code><disabled></code> attribute on a <code><fieldset></code>. Use custom JavaScript to disable the fieldset in these browsers.</p>
<p>Bootstrap includes validation styles for error, warning, info, and success messages. To use:</p>
<ul>
<li>Add <code>.has-warning</code>, <code>.has-error</code>, or <code>.has-success</code> to the parent element</li>
<li>Add .input-with-feedback to the field(s) in question</li>
</ul>
<p>Validation styles are applied on a per-input basis. With horizontal forms, the <code><label class="control-label"></code> will always be styled.</p>
<h2id="forms-extending">Extending form controls</h2>
<p>Adding on top of existing browser controls, Bootstrap includes other useful form components.</p>
<h3id="forms-input-groups">Input groups</h3>
<p>Add text or buttons before, after, or on both sides of any text-based input. Use <code>.input-group</code> with a <code>.add-on</code> to prepend or append elements to an <code><input></code>.</p>
<p>Buttons in input groups are a bit different and require one extra level of nesting. Instead of <code>.input-group-addon</code>, you'll need to use <code>.input-group-btn</code> to wrap the buttons. This is required due to default browser styles that cannot be overridden.</p>
<p>Use relative sizing classes like <code>.input-large</code> or match your inputs to the grid column sizes using <code>.col-span-*</code> classes.</p>
<h4>Relative sizing</h4>
<p>Create larger or smaller form controls that match button sizes.</p>
<p>End a form with a group of actions (buttons). When placed within a <code>.form-horizontal</code>, the buttons will automatically indent to line up with the form controls.</p>
<p>If you add the <code>disabled</code> attribute to a <code><button></code>, Internet Explorer 9 and below will render text gray with a nasty text-shadow that we cannot fix.</p>
</div>
<h3>Anchor element</h3>
<p>Add the <code>.disabled</code> class to <code><a></code> buttons.</p>
<p>As a best practice, <strong>we highly recommend using the <code><button></code> element whenever possible</strong> to ensure matching cross-browser rendering.</p>
<p>Clear the <code>float</code> on any element. Utilizes <ahref="http://nicolasgallagher.com/micro-clearfix-hack/">the micro clearfix</a> as popularized by Nicolas Gallagher.</p>
<pclass="lead">For faster mobile-friendly development, use these utility classes for showing and hiding content by device via media query. Also included are utility classes for toggling content when printed.</p>
<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. Responsive utilities should not be used with tables, and as such are not supported.</p>
<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>