Fbootstrapp

Fbootstrapp is a toolkit designed to kickstart development of facebook iframe apps in both relevant sizes. It includes base CSS and HTML for typography, forms, buttons, tables, grids, navigation, and more, styled in the typical facebook look and feel.

Visit the github project »

Based on Bootstrap

Fbootstrap is based on Twitter's excellent Bootstrap, as the name might indicate.

View details »

Built with less

Fbootstrapp comes with the same less goodness as Bootstrap.

Styled for Facebook

As some researchers found out, it is more intuitive for users to style elements within apps and fanpages in the same look as the parenting facebook site.

View details »

Build fanpage tabs

Fbootstrapp includes a 520px grid perfectly suited to create fanpage tabs.

View details »

Build canvas apps

Additionally to the 520px grid, a 760px grid suitable to the bigger standalone app canvas is included.

View details »

Twitter @clmnsk

Go and build awesome apps for facebook! Then tell me about it on twitter:

Default grids

The default grid systems provided as part of FBootstrappp are a 760px and a 520px wide 12-column grids. They are a flavor of the popular 960 grid system, but without the additional margin/padding on the left and right sides.

760 px grid

  1. <div class="row">
  2. <div class="span6">
  3. ...
  4. </div>
  5. <div class="span10">
  6. ...
  7. </div>
  8. </div>
1
1
1
1
1
1
1
1
1
1
1
1
2
2
2
2
2
2
3
3
3
3
4
4
4
1/3
1/3
1/3
1/3
2/3
2
5
5
6
6
3
9
12

Offsetting columns

4
4 offset 4
1/3 offset 2/3s
4 offset 2
4 offset 2
10 offset 2

Nesting columns

Nest your content if you must by creating a .row within an existing column.

Example of nested columns

Level 1 of column
Level 2
Level 2
  1. <div class="row">
  2. <div class="span12">
  3. Level 1 of column
  4. <div class="row">
  5. <div class="span6">
  6. Level 2
  7. </div>
  8. <div class="span6">
  9. Level 2
  10. </div>
  11. </div>
  12. </div>
  13. </div>

Roll your own grid

Built into Bootstrap are a handful of variables for customizing the default grid system. With a bit of customization, you can modify the size of columns, their gutters, and the container they reside in.

Inside the grid

The variables needed to modify the grid system currently all reside in variables.less.

Variable Default value Description
@gridColumns 16 The number of columns within the grid
@gridColumnWidth 40px The width of each column within the grid
@gridGutterWidth 20px The negative space between each column
@siteWidth Computed sum of all columns and gutters We use some basic match to count the number of columns and gutters and set the width of the .fixed-container() mixin.

Now to customize

Modifying the grid means changing the three @grid-* variables and recompiling the Less files.

Bootstrap comes equipped to handle a grid system with up to 24 columns; the default is just 16. Here's how your grid variables would look customized to a 24-column grid.

  1. @gridColumns: 24;
  2. @gridColumnWidth: 20px;
  3. @gridGutterWidth: 20px;

Once recompiled, you'll be set!

Headings & copy

A standard typographic hierarchy for structuring your webpages.

The entire typographic grid is based on two Less variables in our variables.less file: @basefont and @baseline. 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.

h1. Heading 1

h2. Heading 2

h3. Heading 3

h4. Heading 4

h5. Heading 5
h6. Heading 6

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

Example heading Has sub-heading…

Tab headingTest link
<h5 class="tab">

Misc. elements

Using emphasis, addresses, & abbreviations

<strong> <em> <address> <abbr>

When to use

Emphasis tags (<strong> and <em>) should be used to indicate additional importance or emphasis of a word or phrase relative to its surrounding copy. Use <strong> for importance and <em> for stress emphasis.

Emphasis in a paragraph

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: It's still okay to use <b> and <i> tags in HTML5 and they don't have to be styled bold and italic, respectively (although if there is a more semantic element, use it). <b> is meant to highlight words or phrases without conveying additional importance, while <i> is mostly for voice, technical terms, etc.

Addresses

The <address> element is used for contact information for its nearest ancestor, or the entire body of work. Here are two examples of how it could be used:

Twitter, Inc.
795 Folsom Ave, Suite 600
San Francisco, CA 94107
P: (123) 456-7890

Note: Each line in an <address> must end with a line-break (<br />) or be wrapped in a block-level tag (e.g., <p>) to properly structure the content.

Abbreviations

For abbreviations and acronyms, use the <abbr> tag (<acronym> is deprecated in HTML5). Put the shorthand form within the tag and set a title for the complete name.

Blockquotes

<blockquote> <p> <small>

How to quote

To include a blockquote, wrap <blockquote> around <p> and <small> tags. Use the <small> element to cite your source and you'll get an em dash &mdash; before it.

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

Dr. Julius Hibbert
  1. <blockquote>
  2. <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante venenatis dapibus posuere velit aliquet.</p>
  3. <small>Dr. Julius Hibbert</small>
  4. </blockquote>

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

<code> <pre>

Pimp your code in style with two simple tags. For even more awesomeness through javascript, drop in Google's code prettify library and you're set.

Presenting code

Code, blocks of or just snippets inline, can be displayed with style just by wrapping in the right tag. For blocks of code spanning multiple lines, use the <pre> element. For inline code, use the <code> element.

Element Result
<code> In a line of text like this, your wrapped code will look like this <html> element.
<pre>
<div>
  <h1>Heading</h1>
  <p>Something right here...</p>
</div>

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

<pre class="prettyprint">

Using the google-code-prettify library, your blocks of code get a slightly different visual style and automatic syntax highlighting.

<div>
  <h1>Heading</h1>
  <p>Something right here...</p>
</div>

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

Inline labels

<span class="label">

Call attention to or flag any phrase in your body text.

Label anything

Ever needed one of those fancy New! or Important flags when writing code? Well, now you have them. Here's what's included by default:

Label Result
<span class="label">Default</span> Default
<span class="label success">New</span> New
<span class="label warning">Warning</span> Warning
<span class="label important">Important</span> Important
<span class="label notice">Notice</span> Notice
Some Text<span class="label num">Numeric Indication</span> Some Text13

Media grid

Display thumbnails of varying sizes on pages with a low HTML footprint and minimal styles.

Example thumbnails

Thumbnails in the .media-grid can be any size, but they work best when mapped directly to the built-in Bootstrap grid system. Image widths like 90, 210, and 330 combine with a few pixels of padding to equal the .span2, .span4, and .span6 column sizes.

Large

Medium

Small

Coding them

Media grids are easy to use and rather simple on the markup side. Their dimensions are purely based on the size of the images included.

  1. <ul class="media-grid">
  2. <li>
  3. <a href="#">
  4. <img class="thumbnail" src="http://placehold.it/330x230" alt="">
  5. </a>
  6. </li>
  7. <li>
  8. <a href="#">
  9. <img class="thumbnail" src="http://placehold.it/330x230" alt="">
  10. </a>
  11. </li>
  12. </ul>

Building tables

<table> <thead> <tbody> <tr> <th> <td> <colspan> <caption>

Tables are great—for a lot of things. Great tables, however, need a bit of markup love to be useful, scalable, and readable (at the code level). Here are a few tips to help.

Always wrap your column headers in a <thead> such that hierarchy is <thead> > <tr> > <th>.

Similar to the column headers, all your table’s body content should be wrapped in a <tbody> so your hierarchy is <tbody> > <tr> > <td>.

Example: Default table styles

All tables will be automatically styled with only the essential borders to ensure readability and maintain structure. No need to add extra classes or attributes.

# First Name Last Name Language
1 Some One English
2 Joe Sixpack English
3 Stu Dent Code
  1. <table>
  2. ...
  3. </table>

Example: Condensed table

For tables that require more data in tighter spaces, use the condensed flavor that cuts padding in half. It can also be used in conjunction with borders and zebra-stripes, just like the default table styles.

# First Name Last Name Language
1 Some One English
2 Joe Sixpack English
3 Stu Dent Code
  1. <table class="condensed-table">
  2. ...
  3. </table>

Example: Bordered table

Make your tables look just a wee bit sleeker by rounding their corners and adding borders on all sides.

# First Name Last Name Language
1 Some One English
2 Joe Sixpack English
3 Stu Dent Code
  1. <table class="bordered-table">
  2. ...
  3. </table>

Example: Zebra-striped

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

# First Name Last Name Language
1 Some One English
2 Joe Sixpack English
3 Stu Dent Code
span 4 columns
span 2 columns span 2 columns

Note: Zebra-striping is a progressive enhancement not available for older browsers like IE8 and below.

  1. <table class="zebra-striped">
  2. ...
  3. </table>

Example: Zebra-striped w/ TableSorter.js

Taking the previous example, we improve the usefulness of our tables by providing sorting functionality via jQuery and the Tablesorter plugin. Click any column’s header to change the sort.

# First Name Last Name Language
2 Joe Sixpack English
3 Stu Dent Code
1 Your One English
  1. <script src="js/jquery/jquery.tablesorter.min.js"></script>
  2. <script >
  3. $(function() {
  4. $("table#sortTableExample").tablesorter({ sortList: [[1,0]] });
  5. });
  6. </script>
  7. <table class="zebra-striped">
  8. ...
  9. </table>

Default styles

All forms are given default styles to present them in a readable and scalable way. Styles are provided for text inputs, select lists, textareas, radio buttons and checkboxes, and buttons.

Example form legend
Some value here
Small snippet of help text
Success!
Ruh roh!
Example form legend
@
Here's some help text
Example form legend
Note: Labels surround all the options for much larger click areas and a more usable form.
to All times are shown as Pacific Standard Time (GMT -08:00).
Block of help text to describe the field above if need be.
 

Stacked forms

Add .form-stacked to your form’s HTML and you’ll have labels on top of their fields instead of to their left. This works great if your forms are short or you have two columns of inputs for heavier forms.

Example form legend
Example form legend
Small snippet of help text
Note: Labels surround all the options for much larger click areas and a more usable form.
 

Form field sizes

Customize any form input, select, or textarea width by adding just a few classes to your markup.

As of v1.3.0, we have added the grid-based sizing classes for form elements. Please use the these over the existing .mini, .small, etc classes.

Buttons

As a convention, buttons are used for actions while links are used for objects. For instance, "Download" could be a button and "recent activity" could be a link.

All buttons default to a light gray style, but a number of functional classes can be applied for different color styles. These classes include a blue .primary class, a light-blue .info class, a green .success class, and a red .danger class.

Example buttons

Button styles can be applied to anything with the .btn applied. Typically you’ll want to apply these to only <a>, <button>, and select <input> elements. Here’s how it looks:

    

Alternate sizes

Fancy larger or smaller buttons? Have at it!

Disabled state

For buttons that are not active or are disabled by the app for one reason or another, use the disabled state. That’s .disabled for links and :disabled for <button> elements.

Links

Buttons

 

Basic alerts

.alert-message

One-line messages for highlighting the failure, possible failure, or success of an action. Particularly useful for forms.

Get the javascript »

×

Holy guacamole! Best check yo self, you’re not looking too good.

×

Oh snap! Change this and that and try again.

×

Well done! You successfully read this alert message.

×

Heads up! This is an alert that needs your attention, but it’s not a huge priority just yet.

Example code

  1. <div class="alert-message warning">
  2. <a class="close" href="#">×</a>
  3. <p><strong>Holy guacamole!</strong> Best check yo self, you’re not looking too good.</p>
  4. </div>

Block messages

.alert-message.block-message

For messages that require a bit of explanation, we have paragraph style alerts. These are perfect for bubbling up longer error messages, warning a user of a pending action, or just presenting information for more emphasis on the page.

Get the javascript »

×

Holy guacamole! This is a warning! Best check yo self, you’re not looking too good. Nulla vitae elit libero, a pharetra augue. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

×

Oh snap! You got an error! Change this and that and try again.

  • Duis mollis est non commodo luctus
  • Nisi erat porttitor ligula
  • Eget lacinia odio sem nec elit
×

Well done! You successfully read this alert message. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Maecenas faucibus mollis interdum.

×

Heads up! This is an alert that needs your attention, but it’s not a huge priority just yet.

Example code

  1. <div class="alert-message block-message warning">
  2. <a class="close" href="#">×</a>
  3. <p><strong>Holy guacamole! This is a warning!</strong> Best check yo self, you’re not looking too good. Nulla vitae elit libero, a pharetra augue. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.</p>
  4. <div class="alert-actions">
  5. <a class="btn small" href="#">Take this action</a> <a class="btn small" href="#">Or do this</a>
  6. </div>
  7. </div>

Modals

Modals—dialogs or lightboxes—are great for contextual actions in situations where it’s important that the background context be maintained.

Get the javascript »

Popovers

Use popovers to provide subtextual information to a page without affecting layout.

Get the javascript »

Popover Title

Etiam porta sem malesuada magna mollis euismod. Maecenas faucibus mollis interdum. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.

Getting started

Integrating javascript with the Bootstrap library is super easy. Below we go over the basics and provide you with some awesome plugins to get you started!

View javascript docs »

What's included

Bring some of Bootstrap's primary components to life with new custom plugins that work with jQuery and Ender. We encourage you to extend and modify them to fit your specific development needs.

File Description
bootstrap-modal.js Our Modal plugin is a super slim take on the traditional modal js plugin! We took special care to include only the bare functionality that we require at twitter.
bootstrap-alerts.js The alert plugin is a super tiny class for adding close functionality to alerts.
bootstrap-dropdown.js This plugin is for adding dropdown interaction to the bootstrap topbar or tabbed navigations.
bootstrap-scrollspy.js The ScrollSpy plugin is for adding an auto updating nav based on scroll position to the bootstrap topbar.
bootstrap-buttons.js This plugin offers additional functionality for managing button state.
bootstrap-tabs.js This plugin adds quick, dynamic tab and pill functionality for cycling through local content.
bootstrap-twipsy.js Based on the excellent jQuery.tipsy plugin written by Jason Frame; twipsy is an updated version, which doesn't rely on images, uses css3 for animations, and data-attributes for local title storage!
bootstrap-popover.js The popover plugin provides a simple interface for adding popovers to your application. It extends the boostrap-twipsy.js plugin, so be sure to grab that file as well when including popovers in your project!

Is javascript necessary?

Nope! Bootstrap is designed first and foremost to be a CSS library. This javascript provides a basic interactive layer on top of the included styles.

However, for those who do need javascript, we've provided the plugins above to help you understand how to integrate Bootstrap with javascript and to give you a quick, lightweight option for the basic functionality right away.

For more information and to see some live demos, please refer to our plugin documentation page.