CSS style guide - white page
On top of the scaffolding, basic HTML elements are styled and enhanced with extensible classes to provide a fresh, consistent look and feel.
Headings & body copy
Example body text
This is paragraph. 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
Blockquotes
| Element | Usage | Optional |
|---|---|---|
<blockquote> |
Block-level element for quoting content from another source |
Add .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 — 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>
- Lorem ipsum dolor sit amet
- Consectetur adipiscing elit
- Integer molestie lorem at massa
- Facilisis in pretium nisl aliquet
- Nulla volutpat aliquam velit
- Faucibus porta lacus fringilla vel
- Aenean sit amet erat nunc
- 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.
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:
795 Folsom Ave, Suite 600
San Francisco, CA 94107
P: (123) 456-7890 Full Name
first.last@gmail.com
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.
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 |