# Typography Headings, paragraphs, lists, and other inline type elements

## Headings & body copy

### Typographic scale

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.

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

### Example body text

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. Heading 1

## h2. Heading 2

### h3. Heading 3

#### h4. Heading 4

##### h5. Heading 5

###### h6. Heading 6

## Emphasis, address, and abbreviation

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

### Using emphasis

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.

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.

### Example addresses

Here are two examples of how the `<address>` tag can be used:

### Example abbreviations

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.

HTML is the best thing since sliced bread.

An abbreviation of the word attribute is attr.

## Blockquotes

Element | Usage | Optional
--- | --- | ---
`<blockquote>` | Block-level element for quoting content from another source | Add `cite` attribute for source URL Use `.pull-left` and `.pull-right` classes for floated options
`<small>` | Optional element for adding a user-facing citation, typically an author with title of work | Place the `<cite>` around the title or name of source

To include a blockquote, wrap `<blockquote>` around any HTML as the quote. For straight quotes we recommend a `<p>`.

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

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

### Example blockquotes

Default blockquotes are styled as such:

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

> Someone famous in Body of work

To float your blockquote to the right, add `class="pull-right"`:

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

> Someone famous in Body of work

## Lists

#### Unordered

`<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

#### Unstyled

`<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

#### Ordered

`<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

#### Description

`<dl>`

Description lists
  A description list is perfect for defining terms.
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.

# Code Inline and block code snippets

## Inline

Wrap inline snippets of code with `<code>`.

    For example, <code>section</code> should be wrapped as inline.

## Basic block

Use `<pre>` for multiple lines of code. Be sure to turn any angle brackets into unicode characters for proper rendering.

    <p>Sample text here...</p>

    <pre>
      &lt;p&gt;Sample text here...&lt;/p&gt;
    </pre>

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

## Google Prettify

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

    <p>Sample text here...</p>

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

Download google-code-prettify and view the readme for how to use.

# Tables For, you guessed it, tabular data

## Table markup

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

    <table>
      <thead>
        <tr>
          <th>…</th>
          <th>…</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td>…</td>
          <td>…</td>
        </tr>
      </tbody>
    </table>

## Table options

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

## Example tables

### 1. Default table styles

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

    <table class="table">
      …
    </table>

# | First Name | Last Name | Language
--- | --- | --- | ---
1 | Mark | Otto | CSS
2 | Jacob | Thornton | Javascript
3 | Stu | Dent | HTML

### 2. Striped table

Get a little fancy with your tables by adding zebra-striping—just add the `.table-striped` class.

Note: Striped tables use the `:nth-child` CSS selector and is not available in IE7-IE8.

    <table class="table table-striped">
      …
    </table>

# | First Name | Last Name | Language
--- | --- | --- | ---
1 | Mark | Otto | CSS
2 | Jacob | Thornton | Javascript
3 | Stu | Dent | HTML

### 3. Bordered table

Add borders around the entire table and rounded corners for aesthetic purposes.

    <table class="table table-bordered">
      …
    </table>

# | First Name | Last Name | Language
--- | --- | --- | ---
1 | Mark Otto | CSS
2 | Jacob | Thornton | Javascript
| 3 | Stu | Dent
3 | Brosef | Stalin | HTML

### 4. Condensed table

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

    <table class="table table-condensed">
      …
    </table>

# | First Name | Last Name | Language
--- | --- | --- | ---
1 | Mark | Otto | CSS
2 | Jacob | Thornton | Javascript
3 | Stu | Dent | HTML

### 5. Combine them all!

Feel free to combine any of the table classes to achieve different looks by utilizing any of the available classes.

    <table class="table table-striped table-bordered table-condensed">
      ...
    </table>

# | First Name | Last Name | Language
--- | --- | --- | ---
1 | Mark | Otto | CSS
2 | Jacob | Thornton | Javascript
3 | Stu | Dent | HTML
4 | Brosef | Stalin | HTML

# Forms

## Flexible HTML and CSS

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.

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

## Four layouts included

Bootstrap comes with support for four types of form layouts:

- Vertical (default)
- Search
- Inline
- Horizontal

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

## Control states and more

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.

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

## Four types of forms

Bootstrap provides simple markup and styles for four styles of common web forms.

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

## Example forms using just form controls, no extra markup

### Basic form

With v2.0, we have lighter and smarter defaults for form styles. No extra markup, just form controls.

Label name Associated help text! Check me out

### Search form

Reflecting default WebKit styles, just add `.form-search` for extra rounded search fields.

### Inline form

Inputs are block level to start. For `.form-inline` and `.form-horizontal`, we use inline-block.

## Horizontal forms

Controls Bootstrap supports
Text input

In addition to freeform text, any HTML5 text-based input appears like so.

Checkbox
Option one is this and that—be sure to include why it's great
Select list
Multicon-select
File input
Textarea

### What's included

Shown on the left are all the default form controls we support. Here's the bulleted list:

- text inputs (text, password, email, etc)
- checkbox
- radio
- select
- multiple select
- file input
- textarea

### New defaults with v2.0

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.

Form control states
Focused input
Uneditable input
Some value here
Disabled input
Disabled checkbox
This is a disabled checkbox
Input with warning
Something may have gone wrong
Input with error
Please correct the error
Input with success
Woohoo!
Select with success
Woohoo!

### Redesigned browser states

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`.

### Form validation

It also includes validation styles for errors, warnings, and success. To use, add the error class to the surrounding `.control-group`.

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

Extending form controls
Form sizes

Use the same `.span*` classes from the grid system for input sizes.

Prepended text
@

Here's some help text

Appended text
.00

Here's more help text

Inline checkboxes
1 2 3
Checkboxes
Option one is this and that—be sure to include why it's great Option two can also be checked and included in form results Option three can—yes, you guessed it—also be checked and included in form results

Note: Labels surround all the options for much larger click areas and a more usable form.

Radio buttons
Option one is this and that—be sure to include why it's great Option two can is something else and selecting it will deselect option one

### Prepend & append inputs

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.

### Checkboxes and radios

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">`.

Inline checkboxes and radios are also supported. Just add `.inline` to any `.checkbox` or `.radio` and you're done.

#### Inline forms and append/prepend

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.

#### Form help text

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.

# Buttons

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

### Buttons for actions

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.

### For anchors and forms

Button styles can be applied to anything with the `.btn` applied. However, typically you'll want to apply these to only `<a>` and `<button>` elements.

Note: All buttons must include the `.btn` class. Button styles should be applied to `<button>` and `<a>` elements for consistency.

### Multiple sizes

Fancy larger or smaller buttons? Add `.btn-large` or `.btn-small` for two additional sizes.

Primary action Action

Primary action Action

### Disabled state

For disabled buttons, use `.btn-disabled` for links and `:disabled` for `<button>` elements.

Primary action Action

### Cross browser compatibility

In IE9, we drop the gradient on all buttons in favor of rounded corners as IE9 doesn't crop background gradients to the corners.

Related, IE9 jankifies disabled `button` elements, rendering text gray with a nasty text-shadow—unfortunately we can't fix this.

# Icons Graciously provided by Glyphicons

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.

### Built as a sprite

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.

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.

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.

### How to use

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 class="icon-search"></i>

There are also styles available for inverted (white) icons, made ready with one extra class:

    <i class="icon-search icon-white"></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.

Heads up! The `.icon-` class must be listed first in the class tag for proper CSS targeting.

### Use cases

Icons are great, but where would one use them? Here are a few ideas:

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

Essentially, anywhere you can put an `<i>` tag, you can put an icon.

### Examples

Use them in buttons, button groups for a toolbar, navigation, or prepended form inputs.

User

Refresh Checkout Delete

Comment Settings More Info

Email address