{{_i}}Base CSS{{/i}}

{{_i}}On top of the scaffolding, basic HTML elements are styled and enhanced with extensible classes to provide a fresh, consistent look and feel.{{/i}}

{{_i}}Headings & body copy{{/i}}

{{_i}}Typographic scale{{/i}}

{{_i}}The entire typographic grid is based on two Less variables in our variables.less file: @baseFontSize and @baseLineHeight. The first is the base font-size used throughout and the second is the base line-height.{{/i}}

{{_i}}We use those variables, and some math, to create the margins, paddings, and line-heights of all our type and more.{{/i}}

{{_i}}Example body text{{/i}}

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 ut id elit.

Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Donec sed odio dui.

h1. {{_i}}Heading 1{{/i}}

h2. {{_i}}Heading 2{{/i}}

h3. {{_i}}Heading 3{{/i}}

h4. {{_i}}Heading 4{{/i}}

h5. {{_i}}Heading 5{{/i}}
h6. {{_i}}Heading 6{{/i}}

{{_i}}Emphasis, address, and abbreviation{{/i}}

{{_i}}Element{{/i}} {{_i}}Usage{{/i}} {{_i}}Optional{{/i}}
<strong> {{_i}}For emphasizing a snippet of text with important{{/i}} {{_i}}None{{/i}}
<em> {{_i}}For emphasizing a snippet of text with stress{{/i}} {{_i}}None{{/i}}
<abbr> {{_i}}Wraps abbreviations and acronyms to show the expanded version on hover{{/i}} {{_i}}Include optional title for expanded text{{/i}}
<address> {{_i}}For contact information for its nearest ancestor or the entire body of work{{/i}} {{_i}}Preserve formatting by ending all lines with <br>{{/i}}

{{_i}}Using emphasis{{/i}}

Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Maecenas faucibus mollis interdum. Nulla vitae elit libero, a pharetra augue.

{{_i}}Note: Feel free to use <b> and <i> in HTML5, but their usage has changed a bit. <b> is meant to highlight words or phrases without conveying additional importance while <i> is mostly for voice, technical terms, etc.{{/i}}

{{_i}}Example addresses{{/i}}

{{_i}}Here are two examples of how the <address> tag can be used:{{/i}}

Twitter, Inc.
795 Folsom Ave, Suite 600
San Francisco, CA 94107
P: (123) 456-7890
{{_i}}Full Name{{/i}}
{{_i}}first.last@gmail.com{{/i}}

{{_i}}Example abbreviations{{/i}}

{{_i}}Abbreviations are styled with uppercase text and a light dotted bottom border. They also have a help cursor on hover so users have extra indication something will be shown on hover.{{/i}}

{{_i}}HTML is the best thing since sliced bread.{{/i}}

{{_i}}An abbreviation of the word attribute is attr.{{/i}}

{{_i}}Blockquotes{{/i}}

{{_i}}Element{{/i}} {{_i}}Usage{{/i}} {{_i}}Optional{{/i}}
<blockquote> {{_i}}Block-level element for quoting content from another source{{/i}}

{{_i}}Add cite attribute for source URL{{/i}}

{{_i}}Use .pull-left and .pull-right classes for floated options{{/i}}
<small> {{_i}}Optional element for adding a user-facing citation, typically an author with title of work{{/i}} {{_i}}Place the <cite> around the title or name of source{{/i}}

{{_i}}To include a blockquote, wrap <blockquote> around any HTML as the quote. For straight quotes we recommend a <p>.{{/i}}

{{_i}}Include an optional <small> element to cite your source and you'll get an em dash &mdash; before it for styling purposes.{{/i}}

<blockquote>
  <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante venenatis.</p>
  <small>{{_i}}Someone famous{{/i}}</small>
</blockquote>

{{_i}}Example blockquotes{{/i}}

{{_i}}Default blockquotes are styled as such:{{/i}}

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante venenatis.

{{_i}}Someone famous in Body of work{{/i}}

{{_i}}To float your blockquote to the right, add class="pull-right":{{/i}}

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante venenatis.

{{_i}}Someone famous in Body of work{{/i}}

{{_i}}Lists{{/i}}

{{_i}}Unordered{{/i}}

<ul>

  • Lorem ipsum dolor sit amet
  • Consectetur adipiscing elit
  • Integer molestie lorem at massa
  • Facilisis in pretium nisl aliquet
  • Nulla volutpat aliquam velit
    • Phasellus iaculis neque
    • Purus sodales ultricies
    • Vestibulum laoreet porttitor sem
    • Ac tristique libero volutpat at
  • Faucibus porta lacus fringilla vel
  • Aenean sit amet erat nunc
  • Eget porttitor lorem

{{_i}}Unstyled{{/i}}

<ul class="unstyled">

  • Lorem ipsum dolor sit amet
  • Consectetur adipiscing elit
  • Integer molestie lorem at massa
  • Facilisis in pretium nisl aliquet
  • Nulla volutpat aliquam velit
    • Phasellus iaculis neque
    • Purus sodales ultricies
    • Vestibulum laoreet porttitor sem
    • Ac tristique libero volutpat at
  • Faucibus porta lacus fringilla vel
  • Aenean sit amet erat nunc
  • Eget porttitor lorem

{{_i}}Ordered{{/i}}

<ol>

  1. Lorem ipsum dolor sit amet
  2. Consectetur adipiscing elit
  3. Integer molestie lorem at massa
  4. Facilisis in pretium nisl aliquet
  5. Nulla volutpat aliquam velit
  6. Faucibus porta lacus fringilla vel
  7. Aenean sit amet erat nunc
  8. Eget porttitor lorem

{{_i}}Description{{/i}}

<dl>

{{_i}}Description lists{{/i}}
{{_i}}A description list is perfect for defining terms.{{/i}}
Euismod
Vestibulum id ligula porta felis euismod semper eget lacinia odio sem nec elit.
Donec id elit non mi porta gravida at eget metus.
Malesuada porta
Etiam porta sem malesuada magna mollis euismod.

Inline

Wrap inline snippets of code with <code>.

{{_i}}For example, <code>section</code> should be wrapped as inline.{{/i}}

Basic block

{{_i}}Use <pre> for multiple lines of code. Be sure to turn any angle brackets into unicode characters for proper rendering.{{/i}}

<p>{{_i}}Sample text here...{{/i}}</p>
<pre>
  &lt;p&gt;{{_i}}Sample text here...{{/i}}&lt;/p&gt;
</pre>

{{_i}}Note: Be sure to keep code within <pre> tags as close to the left as possible; it will render all tabs.{{/i}}

{{_i}}You may optionally add the .pre-scrollable class which will set a max-height of 350px and provide a y-axis scrollbar.{{/i}}

Google Prettify

Take the same <pre> element and add two optional classes for enhanced rendering.

<p>{{_i}}Sample text here...{{/i}}</p>
<pre class="prettyprint
     linenums">
  &lt;p&gt;{{_i}}Sample text here...{{/i}}&lt;/p&gt;
</pre>

{{_i}}Download google-code-prettify and view the readme for how to use.{{/i}}

{{_i}}Table markup{{/i}}

{{_i}}Tag{{/i}} {{_i}}Description{{/i}}
<table> {{_i}}Wrapping element for displaying data in a tabular format{{/i}}
<thead> {{_i}}Container element for table header rows (<tr>) to label table columns{{/i}}
<tbody> {{_i}}Container element for table rows (<tr>) in the body of the table{{/i}}
<tr> {{_i}}Container element for a set of table cells (<td> or <th>) that appears on a single row{{/i}}
<td> {{_i}}Default table cell{{/i}}
<th> {{_i}}Special table cell for column (or row, depending on scope and placement) labels{{/i}}
{{_i}}Must be used within a <thead>{{/i}}
<caption> {{_i}}Description or summary of what the table holds, especially useful for screen readers{{/i}}
<table>
  <thead>
    <tr>
      <th>…</th>
      <th>…</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>…</td>
      <td>…</td>
    </tr>
  </tbody>
</table>

{{_i}}Table options{{/i}}

{{_i}}Name{{/i}} {{_i}}Class{{/i}} {{_i}}Description{{/i}}
{{_i}}Default{{/i}} {{_i}}None{{/i}} {{_i}}No styles, just columns and rows{{/i}}
{{_i}}Basic{{/i}} .table {{_i}}Only horizontal lines between rows{{/i}}
{{_i}}Bordered{{/i}} .table-bordered {{_i}}Rounds corners and adds outer border{{/i}}
{{_i}}Zebra-stripe{{/i}} .table-striped {{_i}}Adds light gray background color to odd rows (1, 3, 5, etc){{/i}}
{{_i}}Condensed{{/i}} .table-condensed {{_i}}Cuts vertical padding in half, from 8px to 4px, within all td and th elements{{/i}}

{{_i}}Example tables{{/i}}

1. {{_i}}Default table styles{{/i}}

{{_i}}Tables are automatically styled with only a few borders to ensure readability and maintain structure. With 2.0, the .table class is required.{{/i}}

<table class="table">
  …
</table>
# {{_i}}First Name{{/i}} {{_i}}Last Name{{/i}} {{_i}}Language{{/i}}
1 Mark Otto CSS
2 Jacob Thornton Javascript
3 Stu Dent HTML

2. {{_i}}Striped table{{/i}}

{{_i}}Get a little fancy with your tables by adding zebra-striping—just add the .table-striped class.{{/i}}

{{_i}}Note: Striped tables use the :nth-child CSS selector and is not available in IE7-IE8.{{/i}}

<table class="table table-striped">
  …
</table>
# {{_i}}First Name{{/i}} {{_i}}Last Name{{/i}} {{_i}}Language{{/i}}
1 Mark Otto CSS
2 Jacob Thornton Javascript
3 Stu Dent HTML

3. {{_i}}Bordered table{{/i}}

{{_i}}Add borders around the entire table and rounded corners for aesthetic purposes.{{/i}}

<table class="table table-bordered">
  …
</table>
# {{_i}}First Name{{/i}} {{_i}}Last Name{{/i}} {{_i}}Language{{/i}}
1 Mark Otto CSS
2 Jacob Thornton Javascript
3 Stu Dent
3 Brosef Stalin HTML

4. {{_i}}Condensed table{{/i}}

{{_i}}Make your tables more compact by adding the .table-condensed class to cut table cell padding in half (from 8px to 4px).{{/i}}

<table class="table table-condensed">
  …
</table>
# {{_i}}First Name{{/i}} {{_i}}Last Name{{/i}} {{_i}}Language{{/i}}
1 Mark Otto CSS
2 Jacob Thornton Javascript
3 Stu Dent HTML

5. {{_i}}Combine them all!{{/i}}

{{_i}}Feel free to combine any of the table classes to achieve different looks by utilizing any of the available classes.{{/i}}

<table class="table table-striped table-bordered table-condensed">
  ...
</table>
# {{_i}}First Name{{/i}} {{_i}}Last Name{{/i}} {{_i}}Language{{/i}}
1 Mark Otto CSS
2 Jacob Thornton Javascript
3 Stu Dent HTML
4 Brosef Stalin HTML

{{_i}}Flexible HTML and CSS{{/i}}

{{_i}}The best part about forms in Bootstrap is that all your inputs and controls look great no matter how you build them in your markup. No superfluous HTML is required, but we provide the patterns for those who require it.{{/i}}

{{_i}}More complicated layouts come with succinct and scalable classes for easy styling and event binding, so you're covered at every step.{{/i}}

{{_i}}Four layouts included{{/i}}

{{_i}}Bootstrap comes with support for four types of form layouts:{{/i}}

  • {{_i}}Vertical (default){{/i}}
  • {{_i}}Search{{/i}}
  • {{_i}}Inline{{/i}}
  • {{_i}}Horizontal{{/i}}

{{_i}}Different types of form layouts require some changes to markup, but the controls themselves remain and behave the same.{{/i}}

{{_i}}Control states and more{{/i}}

{{_i}}Bootstrap's forms include styles for all the base form controls like input, textarea, and select you'd expect. But it also comes with a number of custom components like appended and prepended inputs and support for lists of checkboxes.{{/i}}

{{_i}}States like error, warning, and success are included for each type of form control. Also included are styles for disabled controls.{{/i}}

{{_i}}Four types of forms{{/i}}

{{_i}}Bootstrap provides simple markup and styles for four styles of common web forms.{{/i}}

{{_i}}Name{{/i}} {{_i}}Class{{/i}} {{_i}}Description{{/i}}
{{_i}}Vertical (default){{/i}} .form-vertical ({{_i}}not required{{/i}}) {{_i}}Stacked, left-aligned labels over controls{{/i}}
{{_i}}Inline{{/i}} .form-inline {{_i}}Left-aligned label and inline-block controls for compact style{{/i}}
{{_i}}Search{{/i}} .form-search {{_i}}Extra-rounded text input for a typical search aesthetic{{/i}}
{{_i}}Horizontal{{/i}} .form-horizontal {{_i}}Float left, right-aligned labels on same line as controls{{/i}}

{{_i}}Example forms using just form controls, no extra markup{{/i}}

{{_i}}Basic form{{/i}}

{{_i}}With v2.0, we have lighter and smarter defaults for form styles. No extra markup, just form controls.{{/i}}

Associated help text!
<form class="well">
  <label>{{_i}}Label name{{/i}}</label>
  <input type="text" class="span3" placeholder="{{_i}}Type something…{{/i}}">
  <span class="help-inline">Associated help text!</span>
  <label class="checkbox">
    <input type="checkbox"> {{_i}}Check me out{{/i}}
  </label>
  <button type="submit" class="btn">{{_i}}Submit{{/i}}</button>
</form>

{{_i}}Search form{{/i}}

{{_i}}Reflecting default WebKit styles, just add .form-search for extra rounded search fields.{{/i}}

<form class="well form-search">
  <input type="text" class="input-medium search-query">
  <button type="submit" class="btn">{{_i}}Search{{/i}}</button>
</form>

{{_i}}Inline form{{/i}}

{{_i}}Inputs are block level to start. For .form-inline and .form-horizontal, we use inline-block.{{/i}}

<form class="well form-inline">
  <input type="text" class="input-small" placeholder="{{_i}}Email{{/i}}">
  <input type="password" class="input-small" placeholder="{{_i}}Password{{/i}}">
  <button type="submit" class="btn">{{_i}}Go{{/i}}</button>
</form>

{{_i}}Horizontal forms{{/i}}

{{_i}}Controls Bootstrap supports{{/i}}

{{_i}}In addition to freeform text, any HTML5 text-based input appears like so.{{/i}}

{{_i}}Example markup{{/i}}

{{_i}}Given the above example form layout, here's the markup associated with the first input and control group. The .control-group, .control-label, and .controls classes are all required for styling.{{/i}}

<form class="form-horizontal">
  <fieldset>
    <legend>{{_i}}Legend text{{/i}}</legend>
    <div class="control-group">
      <label class="control-label" for="input01">{{_i}}Text input{{/i}}</label>
      <div class="controls">
        <input type="text" class="input-xlarge" id="input01">
        <p class="help-block">{{_i}}Supporting help text{{/i}}</p>
      </div>
    </div>
  </fieldset>
</form>

{{_i}}What's included{{/i}}

{{_i}}Shown on the left are all the default form controls we support. Here's the bulleted list:{{/i}}

  • {{_i}}text inputs (text, password, email, etc){{/i}}
  • {{_i}}checkbox{{/i}}
  • {{_i}}radio{{/i}}
  • {{_i}}select{{/i}}
  • {{_i}}multiple select{{/i}}
  • {{_i}}file input{{/i}}
  • {{_i}}textarea{{/i}}

{{_i}}New defaults with v2.0{{/i}}

{{_i}}Up to v1.4, Bootstrap's default form styles used the horizontal layout. With Bootstrap 2, we removed that constraint to have smarter, more scalable defaults for any form.{{/i}}


{{_i}}Form control states{{/i}}
Some value here
{{_i}}Something may have gone wrong{{/i}}
{{_i}}Please correct the error{{/i}}
{{_i}}Woohoo!{{/i}}
{{_i}}Woohoo!{{/i}}

{{_i}}Redesigned browser states{{/i}}

{{_i}}Bootstrap features styles for browser-supported focused and disabled states. We remove the default Webkit outline and apply a box-shadow in its place for :focus.{{/i}}


{{_i}}Form validation{{/i}}

{{_i}}It also includes validation styles for errors, warnings, and success. To use, add the error class to the surrounding .control-group.{{/i}}

<fieldset
  class="control-group error">
  …
</fieldset>

{{_i}}Extending form controls{{/i}}

{{_i}}Use the same .span* classes from the grid system for input sizes.{{/i}}

@

{{_i}}Here's some help text{{/i}}

.00

{{_i}}Here's more help text{{/i}}

{{_i}}Note: Labels surround all the options for much larger click areas and a more usable form.{{/i}}

{{_i}}Prepend & append inputs{{/i}}

{{_i}}Input groups—with appended or prepended text—provide an easy way to give more context for your inputs. Great examples include the @ sign for Twitter usernames or $ for finances.{{/i}}


{{_i}}Checkboxes and radios{{/i}}

{{_i}}Up to v1.4, Bootstrap required extra markup around checkboxes and radios to stack them. Now, it's a simple matter of repeating the <label class="checkbox"> that wraps the <input type="checkbox">.{{/i}}

{{_i}}Inline checkboxes and radios are also supported. Just add .inline to any .checkbox or .radio and you're done.{{/i}}


{{_i}}Inline forms and append/prepend{{/i}}

{{_i}}To use prepend or append inputs in an inline form, be sure to place the .add-on and input on the same line, without spaces.{{/i}}


{{_i}}Form help text{{/i}}

{{_i}}To add help text for your form inputs, include inline help text with <span class="help-inline"> or a help text block with <p class="help-block"> after the input element.{{/i}}

{{_i}}Button{{/i}} {{_i}}Class{{/i}} {{_i}}Description{{/i}}
{{_i}}Default{{/i}} .btn {{_i}}Standard gray button with gradient{{/i}}
{{_i}}Primary{{/i}} .btn-primary {{_i}}Provides extra visual weight and identifies the primary action in a set of buttons{{/i}}
{{_i}}Info{{/i}} .btn-info {{_i}}Used as an alternate to the default styles{{/i}}
{{_i}}Success{{/i}} .btn-success {{_i}}Indicates a successful or positive action{{/i}}
{{_i}}Warning{{/i}} .btn-warning {{_i}}Indicates caution should be taken with this action{{/i}}
{{_i}}Danger{{/i}} .btn-danger {{_i}}Indicates a dangerous or potentially negative action{{/i}}

{{_i}}Buttons for actions{{/i}}

{{_i}}As a convention, buttons should only be used for actions while hyperlinks are to be used for objects. For instance, "Download" should be a button while "recent activity" should be a link.{{/i}}

{{_i}}Button styles can be applied to anything with the .btn class applied. However, typically you'll want to apply these to only <a> and <button> elements.{{/i}}

{{_i}}Cross browser compatibility{{/i}}

{{_i}}IE9 doesn't crop background gradients on rounded corners, so we remove it. Related, IE9 jankifies disabled button elements, rendering text gray with a nasty text-shadow that we cannot fix.{{/i}}

{{_i}}Multiple sizes{{/i}}

{{_i}}Fancy larger or smaller buttons? Add .btn-large or .btn-small for two additional sizes.{{/i}}

{{_i}}Primary action{{/i}} {{_i}}Action{{/i}}

{{_i}}Primary action{{/i}} {{_i}}Action{{/i}}


{{_i}}Disabled state{{/i}}

{{_i}}For disabled buttons, use .btn-disabled for links and :disabled for <button> elements.{{/i}}

{{_i}}Primary action{{/i}} {{_i}}Action{{/i}}

{{_i}}One class, multiple tags{{/i}}

{{_i}}Use the .btn class on an <a>, <button>, or <input> element.{{/i}}

{{_i}}Link{{/i}}
<a class="btn" href="">{{_i}}Link{{/i}}</a>
<button class="btn" type="submit">
  {{_i}}Button{{/i}}
</button>
<input class="btn" type="button" 
         value="{{_i}}Input{{/i}}">
<input class="btn" type="submit" 
         value="{{_i}}Submit{{/i}}">

{{_i}}As a best practice, try to match the element for you context to ensure matching cross-browser rendering. If you have an input, use an <input type="submit"> for your button.{{/i}}

{{_i}}Heads up! Icon classes are echoed via CSS :after. In the docs, we show a light red background color on hover to highlight the icon's size.{{/i}}

{{_i}}Built as a sprite{{/i}}

{{_i}}Instead of making every icon an extra request, we've compiled them into a sprite—a bunch of images in one file that uses CSS to position the images with background-position. This is the same method we use on Twitter.com and it has worked well for us.{{/i}}

{{_i}}All icons classes are prefixed with .icon- for proper namespacing and scoping, much like our other components. This will help avoid conflicts with other tools.{{/i}}

{{_i}}Glyphicons has granted us use of the Halflings set in our open-source toolkit so long as we provide a link and credit here in the docs. Please consider doing the same in your projects.{{/i}}

{{_i}}How to use{{/i}}

{{_i}}With v2.0.0, we have opted to use an <i> tag for all our icons, but they have no case class—only a shared prefix. To use, place the following code just about anywhere:{{/i}}

<i class="icon-search"></i>

{{_i}}There are also styles available for inverted (white) icons, made ready with one extra class:{{/i}}

<i class="icon-search icon-white"></i>

{{_i}}There are 120 classes to choose from for your icons. Just add an <i> tag with the right classes and you're set. You can find the full list in sprites.less or right here in this document.{{/i}}

{{_i}}Use cases{{/i}}

{{_i}}Icons are great, but where would one use them? Here are a few ideas:{{/i}}

  • {{_i}}As visuals for your sidebar navigation{{/i}}
  • {{_i}}For a purely icon-driven navigation{{/i}}
  • {{_i}}For buttons to help convey the meaning of an action{{/i}}
  • {{_i}}With links to share context on a user's destination{{/i}}

{{_i}}Essentially, anywhere you can put an <i> tag, you can put an icon.{{/i}}

{{_i}}Examples{{/i}}

{{_i}}Use them in buttons, button groups for a toolbar, navigation, or prepended form inputs.{{/i}}