On-scroll animations are one of the most popular and enduring web-development techniques from recent years. With them, HTML elements remain hidden until the user scrolls the page, whereupon the element reveals itself with an impressive animation that makes your site look dynamic and modern, unlike the static pages in the past.
We are using the popular scrollReveal.js script for the onscroll animation feature. You can find all the details and the information you might need on their website.
You can see the scrollReveal.js demo here.
The Widgetkit Media Player is a HTML5 audio and video player completely built HTML and CSS. You can easily embed video files into your website by using the HTML5 video element. A Flash player fallback is included for all unsupported browsers.
This is a MP3 Audio Sample:
Use the HTML5 video
element to embed video in your website. For example:
<video src="/video.mp4" width="320" height="240"></video>
You can also provide multiple sources, to add support for the different video formats like h.264, WebM or Ogg:
<video width="320" height="240"> <source type="video/mp4" src="/video.mp4" /> <source type="video/webm" src="/video.webm" /> <source type="video/ogg" src="/video.ogv" /> </video>
Use the HTML5 audio
element to embed MP3 files in your website. For example:
<audio src="/audio.mp3" type="audio/mp3"></audio>
The Widgetkit Spotlight allows you to add an overlay to your images which fades or moves in on mouse hover. The overlay can be an image or HTML content. The default magnifier spotlight is a perfect match to be used with a lightbox.
If no custom overlay is set the default spotlight fades in an overlay with an magnifier image. If you define a custom overlay you can choose between different animations - fade
, bottom
, top
, right
and left
.
Use the HTML5 custom data attribute data-spotlight
to activate the spotlight.
<a data-spotlight="on" href="/mypage.html"> <img src="/image.jpg" width="180" height="120" alt="" /> </a>
To create a custom overlay use a div element with the CSS class overlay
. You can set the effect parameter to the data attribute. For example:
<a data-spotlight="effect:bottom;" href="/mypage.html"> <img src="/image.jpg" width="180" height="120" alt="" /> <span class="overlay">Custom Overlay</span> </a>
You can set the effect parameter to fade
, bottom
, top
, right
and left
.
The Widgetkit Lightbox allows you to view images, HTML and multi-media content on a dark dimmed overlay without having to leave the current page.
Different animations - fade
, elastic
and none
Different title positions - float
, inside
and over
Various examples in one gallery (try also using the keyboard and mouse scroll wheel)
Use #wk-ID
to load widgets like slideshows or galleries in a lightbox. For example: Widgetkit Slideshow
<a data-lightbox="width:600;height:300;" href="#wk-10">Lightbox</a>
Use the HTML5 custom data attribute data-lightbox
to activate the lightbox. You can set various lightbox parameters to the data attribute. For example:
<a data-lightbox="width:1000;height:600;" href="http://www.wikipedia.org">Lightbox</a>
Here is a list of the most common parameters:
float
, outside
, inside
or over
)fade
, elastic
, or none
)fade
, elastic
, or none
)true
or false
yes
or no
Plugins can be included individually (though some have required dependencies), or all at once. Both bootstrap.js and bootstrap.min.js contain all plugins in a single file.
You can use all Bootstrap plugins purely through the markup API without writing a single line of JavaScript. This is Bootstrap's first class API and should be your first consideration when using a plugin.
That said, in some situations it may be desirable to turn this functionality off. Therefore, we also provide the ability to disable the data attribute API by unbinding all events on the body namespaced with `'data-api'`. This looks like this:
$('body').off('.data-api')
Alternatively, to target a specific plugin, just include the plugin's name as a namespace along with the data-api namespace like this:
$('body').off('.alert.data-api')
We also believe you should be able to use all Bootstrap plugins purely through the JavaScript API. All public APIs are single, chainable methods, and return the collection acted upon.
$(".btn.danger").button("toggle").addClass("fat")
All methods should accept an optional options object, a string which targets a particular method, or nothing (which initiates a plugin with default behavior):
$("#myModal").modal() // initialized with defaults $("#myModal").modal({ keyboard: false }) // initialized with no keyboard $("#myModal").modal('show') // initializes and invokes show immediately
Each plugin also exposes its raw constructor on a `Constructor` property: $.fn.popover.Constructor
. If you'd like to get a particular plugin instance, retrieve it directly from an element: $('[rel=popover]').data('popover')
.
Sometimes it is necessary to use Bootstrap plugins with other UI frameworks. In these circumstances, namespace collisions can occasionally occur. If this happens, you may call .noConflict
on the plugin you wish to revert the value of.
var bootstrapButton = $.fn.button.noConflict() // return $.fn.button to previously assigned value $.fn.bootstrapBtn = bootstrapButton // give $().bootstrapBtn the bootstrap functionality
Bootstrap provides custom events for most plugin's unique actions. Generally, these come in an infinitive and past participle form - where the infinitive (ex. show
) is triggered at the start of an event, and its past participle form (ex. shown
) is trigger on the completion of an action.
All infinitive events provide preventDefault functionality. This provides the ability to stop the execution of an action before it starts.
$('#myModal').on('show', function (e) { if (!data) return e.preventDefault() // stops modal from being shown })
For simple transition effects, include bootstrap-transition.js once alongside the other JS files. If you're using the compiled (or minified) bootstrap.js, there is no need to include this—it's already there.
A few examples of the transition plugin:
Modals are streamlined, but flexible, dialog prompts with the minimum required functionality and smart defaults.
A rendered modal with header, body, and set of actions in the footer.
<div class="modal hide fade"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h3>Modal header</h3> </div> <div class="modal-body"> <p>One fine body…</p> </div> <div class="modal-footer"> <a href="#" class="btn">Close</a> <a href="#" class="btn btn-primary">Save changes</a> </div> </div>
Toggle a modal via JavaScript by clicking the button below. It will slide down and fade in from the top of the page.
Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem.
We set a fixed max-height
on the .modal-body
. Watch it overflow with all this extra lorem ipsum text we've included.
Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.
Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.
Aenean lacinia bibendum nulla sed consectetur. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla.
Cras mattis consectetur purus sit amet fermentum. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.
Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.
Aenean lacinia bibendum nulla sed consectetur. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Donec sed odio dui. Donec ullamcorper nulla non metus auctor fringilla.
<!-- Button to trigger modal --> <a href="#myModal" role="button" class="btn" data-toggle="modal">Launch demo modal</a> <!-- Modal --> <div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h3 id="myModalLabel">Modal header</h3> </div> <div class="modal-body"> <p>One fine body…</p> </div> <div class="modal-footer"> <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button> <button class="btn btn-primary">Save changes</button> </div> </div>
Activate a modal without writing JavaScript. Set data-toggle="modal"
on a controller element, like a button, along with a data-target="#foo"
or href="#foo"
to target a specific modal to toggle.
<button type="button" data-toggle="modal" data-target="#myModal">Launch modal</button>
Call a modal with id myModal
with a single line of JavaScript:
$('#myModal').modal(options)
Options can be passed via data attributes or JavaScript. For data attributes, append the option name to data-
, as in data-backdrop=""
.
Name | type | default | description |
---|---|---|---|
backdrop | boolean | true | Includes a modal-backdrop element. Alternatively, specify static for a backdrop which doesn't close the modal on click. |
keyboard | boolean | true | Closes the modal when escape key is pressed |
show | boolean | true | Shows the modal when initialized. |
remote | path | false | If a remote url is provided, content will be loaded via jQuery's
|
Activates your content as a modal. Accepts an optional options object
.
$('#myModal').modal({ keyboard: false })
Manually toggles a modal.
$('#myModal').modal('toggle')
Manually opens a modal.
$('#myModal').modal('show')
Manually hides a modal.
$('#myModal').modal('hide')
Bootstrap's modal class exposes a few events for hooking into modal functionality.
Event | Description |
---|---|
show | This event fires immediately when the show instance method is called. |
shown | This event is fired when the modal has been made visible to the user (will wait for css transitions to complete). |
hide | This event is fired immediately when the hide instance method has been called. |
hidden | This event is fired when the modal has finished being hidden from the user (will wait for css transitions to complete). |
$('#myModal').on('hidden', function () { // do something… })
Add dropdown menus to nearly anything with this simple plugin, including the navbar, tabs, and pills.
Add data-toggle="dropdown"
to a link or button to toggle a dropdown.
<div class="dropdown"> <a class="dropdown-toggle" data-toggle="dropdown" href="#">Dropdown trigger</a> <ul class="dropdown-menu" role="menu" aria-labelledby="dLabel"> ... </ul> </div>
To keep URLs intact, use the data-target
attribute instead of href="#"
.
<div class="dropdown"> <a class="dropdown-toggle" id="dLabel" role="button" data-toggle="dropdown" data-target="#" href="/page.html"> Dropdown <b class="caret"></b> </a> <ul class="dropdown-menu" role="menu" aria-labelledby="dLabel"> ... </ul> </div>
Call the dropdowns via JavaScript:
$('.dropdown-toggle').dropdown()
None
A programmatic api for toggling menus for a given navbar or tabbed navigation.
The ScrollSpy plugin is for automatically updating nav targets based on scroll position. Scroll the area below the navbar and watch the active class change. The dropdown sub items will be highlighted as well.
Ad leggings keytar, brunch id art party dolor labore. Pitchfork yr enim lo-fi before they sold out qui. Tumblr farm-to-table bicycle rights whatever. Anim keffiyeh carles cardigan. Velit seitan mcsweeney's photo booth 3 wolf moon irure. Cosby sweater lomo jean shorts, williamsburg hoodie minim qui you probably haven't heard of them et cardigan trust fund culpa biodiesel wes anderson aesthetic. Nihil tattooed accusamus, cred irony biodiesel keffiyeh artisan ullamco consequat.
Veniam marfa mustache skateboard, adipisicing fugiat velit pitchfork beard. Freegan beard aliqua cupidatat mcsweeney's vero. Cupidatat four loko nisi, ea helvetica nulla carles. Tattooed cosby sweater food truck, mcsweeney's quis non freegan vinyl. Lo-fi wes anderson +1 sartorial. Carles non aesthetic exercitation quis gentrify. Brooklyn adipisicing craft beer vice keytar deserunt.
Occaecat commodo aliqua delectus. Fap craft beer deserunt skateboard ea. Lomo bicycle rights adipisicing banh mi, velit ea sunt next level locavore single-origin coffee in magna veniam. High life id vinyl, echo park consequat quis aliquip banh mi pitchfork. Vero VHS est adipisicing. Consectetur nisi DIY minim messenger bag. Cred ex in, sustainable delectus consectetur fanny pack iphone.
In incididunt echo park, officia deserunt mcsweeney's proident master cleanse thundercats sapiente veniam. Excepteur VHS elit, proident shoreditch +1 biodiesel laborum craft beer. Single-origin coffee wayfarers irure four loko, cupidatat terry richardson master cleanse. Assumenda you probably haven't heard of them art party fanny pack, tattooed nulla cardigan tempor ad. Proident wolf nesciunt sartorial keffiyeh eu banh mi sustainable. Elit wolf voluptate, lo-fi ea portland before they sold out four loko. Locavore enim nostrud mlkshk brooklyn nesciunt.
Ad leggings keytar, brunch id art party dolor labore. Pitchfork yr enim lo-fi before they sold out qui. Tumblr farm-to-table bicycle rights whatever. Anim keffiyeh carles cardigan. Velit seitan mcsweeney's photo booth 3 wolf moon irure. Cosby sweater lomo jean shorts, williamsburg hoodie minim qui you probably haven't heard of them et cardigan trust fund culpa biodiesel wes anderson aesthetic. Nihil tattooed accusamus, cred irony biodiesel keffiyeh artisan ullamco consequat.
Keytar twee blog, culpa messenger bag marfa whatever delectus food truck. Sapiente synth id assumenda. Locavore sed helvetica cliche irony, thundercats you probably haven't heard of them consequat hoodie gluten-free lo-fi fap aliquip. Labore elit placeat before they sold out, terry richardson proident brunch nesciunt quis cosby sweater pariatur keffiyeh ut helvetica artisan. Cardigan craft beer seitan readymade velit. VHS chambray laboris tempor veniam. Anim mollit minim commodo ullamco thundercats.
To easily add scrollspy behavior to your topbar navigation, just add data-spy="scroll"
to the element you want to spy on (most typically this would be the body) and data-target=".navbar"
to select which nav to use. You'll want to use scrollspy with a .nav
component.
<body data-spy="scroll" data-target=".navbar">...</body>
Call the scrollspy via JavaScript:
$('#navbar').scrollspy()
<a href="#home">home</a>
must correspond to something in the dom like <div id="home"></div>
.
When using scrollspy in conjunction with adding or removing of elements from the DOM, you'll need to call the refresh method like so:
$('[data-spy="scroll"]').each(function () { var $spy = $(this).scrollspy('refresh') });
Options can be passed via data attributes or JavaScript. For data attributes, append the option name to data-
, as in data-offset=""
.
Name | type | default | description |
---|---|---|---|
offset | number | 10 | Pixels to offset from top when calculating position of scroll. |
Event | Description |
---|---|
activate | This event fires whenever a new item becomes activated by the scrollspy. |
Add quick, dynamic tab functionality to transition through panes of local content, even via dropdown menus.
Raw denim you probably haven't heard of them jean shorts Austin. Nesciunt tofu stumptown aliqua, retro synth master cleanse. Mustache cliche tempor, williamsburg carles vegan helvetica. Reprehenderit butcher retro keffiyeh dreamcatcher synth. Cosby sweater eu banh mi, qui irure terry richardson ex squid. Aliquip placeat salvia cillum iphone. Seitan aliquip quis cardigan american apparel, butcher voluptate nisi qui.
Food truck fixie locavore, accusamus mcsweeney's marfa nulla single-origin coffee squid. Exercitation +1 labore velit, blog sartorial PBR leggings next level wes anderson artisan four loko farm-to-table craft beer twee. Qui photo booth letterpress, commodo enim craft beer mlkshk aliquip jean shorts ullamco ad vinyl cillum PBR. Homo nostrud organic, assumenda labore aesthetic magna delectus mollit. Keytar helvetica VHS salvia yr, vero magna velit sapiente labore stumptown. Vegan fanny pack odio cillum wes anderson 8-bit, sustainable jean shorts beard ut DIY ethical culpa terry richardson biodiesel. Art party scenester stumptown, tumblr butcher vero sint qui sapiente accusamus tattooed echo park.
Etsy mixtape wayfarers, ethical wes anderson tofu before they sold out mcsweeney's organic lomo retro fanny pack lo-fi farm-to-table readymade. Messenger bag gentrify pitchfork tattooed craft beer, iphone skateboard locavore carles etsy salvia banksy hoodie helvetica. DIY synth PBR banksy irony. Leggings gentrify squid 8-bit cred pitchfork. Williamsburg banh mi whatever gluten-free, carles pitchfork biodiesel fixie etsy retro mlkshk vice blog. Scenester cred you probably haven't heard of them, vinyl craft beer blog stumptown. Pitchfork sustainable tofu synth chambray yr.
Trust fund seitan letterpress, keytar raw denim keffiyeh etsy art party before they sold out master cleanse gluten-free squid scenester freegan cosby sweater. Fanny pack portland seitan DIY, art party locavore wolf cliche high life echo park Austin. Cred vinyl keffiyeh DIY salvia PBR, banh mi before they sold out farm-to-table VHS viral locavore cosby sweater. Lomo wolf viral, mustache readymade thundercats keffiyeh craft beer marfa ethical. Wolf salvia freegan, sartorial keffiyeh echo park vegan.
Enable tabbable tabs via JavaScript (each tab needs to be activated individually):
$('#myTab a').click(function (e) { e.preventDefault(); $(this).tab('show'); })
You can activate individual tabs in several ways:
$('#myTab a[href="#profile"]').tab('show'); // Select tab by name $('#myTab a:first').tab('show'); // Select first tab $('#myTab a:last').tab('show'); // Select last tab $('#myTab li:eq(2) a').tab('show'); // Select third tab (0-indexed)
You can activate a tab or pill navigation without writing any JavaScript by simply specifying data-toggle="tab"
or data-toggle="pill"
on an element. Adding the nav
and nav-tabs
classes to the tab ul
will apply the Bootstrap tab styling.
<ul class="nav nav-tabs"> <li><a href="#home" data-toggle="tab">Home</a></li> <li><a href="#profile" data-toggle="tab">Profile</a></li> <li><a href="#messages" data-toggle="tab">Messages</a></li> <li><a href="#settings" data-toggle="tab">Settings</a></li> </ul>
Activates a tab element and content container. Tab should have either a data-target
or an href
targeting a container node in the DOM.
<ul class="nav nav-tabs" id="myTab"> <li class="active"><a href="#home">Home</a></li> <li><a href="#profile">Profile</a></li> <li><a href="#messages">Messages</a></li> <li><a href="#settings">Settings</a></li> </ul> <div class="tab-content"> <div class="tab-pane active" id="home">...</div> <div class="tab-pane" id="profile">...</div> <div class="tab-pane" id="messages">...</div> <div class="tab-pane" id="settings">...</div> </div> <script> $(function () { $('#myTab a:last').tab('show'); }) </script>
Event | Description |
---|---|
show | This event fires on tab show, but before the new tab has been shown. Use event.target and event.relatedTarget to target the active tab and the previous active tab (if available) respectively. |
shown | This event fires on tab show after a tab has been shown. Use event.target and event.relatedTarget to target the active tab and the previous active tab (if available) respectively. |
$('a[data-toggle="tab"]').on('shown', function (e) { e.target // activated tab e.relatedTarget // previous tab })
Inspired by the excellent jQuery.tipsy plugin written by Jason Frame; Tooltips are an updated version, which don't rely on images, use CSS3 for animations, and data-attributes for local title storage.
For performance reasons, the tooltip and popover data-apis are opt in, meaning you must initialize them yourself.
Hover over the links below to see tooltips:
Tight pants next level keffiyeh you probably haven't heard of them. Photo booth beard raw denim letterpress vegan messenger bag stumptown. Farm-to-table seitan, mcsweeney's fixie sustainable quinoa 8-bit american apparel have a terry richardson vinyl chambray. Beard stumptown, cardigans banh mi lomo thundercats. Tofu biodiesel williamsburg marfa, four loko mcsweeney's cleanse vegan chambray. A really ironic artisan whatever keytar, scenester farm-to-table banksy Austin twitter handle freegan cred raw denim single-origin coffee viral.
When using tooltips and popovers with the Bootstrap input groups, you'll have to set the container
(documented below) option to avoid unwanted side effects.
Trigger the tooltip via JavaScript:
$('#example').tooltip(options)
Options can be passed via data attributes or JavaScript. For data attributes, append the option name to data-
, as in data-animation=""
.
Name | type | default | description |
---|---|---|---|
animation | boolean | true | apply a css fade transition to the tooltip |
html | boolean | false | Insert html into the tooltip. If false, jquery's text method will be used to insert content into the dom. Use text if you're worried about XSS attacks. |
placement | string | function | 'top' | how to position the tooltip - top | bottom | left | right |
selector | string | false | If a selector is provided, tooltip objects will be delegated to the specified targets. |
title | string | function | '' | default title value if `title` tag isn't present |
trigger | string | 'hover focus' | how tooltip is triggered - click | hover | focus | manual. Note you case pass trigger mutliple, space seperated, trigger types. |
delay | number | object | 0 |
delay showing and hiding the tooltip (ms) - does not apply to manual trigger type If a number is supplied, delay is applied to both hide/show Object structure is: |
container | string | false | false |
Appends the tooltip to a specific element |
<a href="#" data-toggle="tooltip" title="first tooltip">hover over me</a>
Attaches a tooltip handler to an element collection.
Reveals an element's tooltip.
$('#element').tooltip('show')
Hides an element's tooltip.
$('#element').tooltip('hide')
Toggles an element's tooltip.
$('#element').tooltip('toggle')
Hides and destroys an element's tooltip.
$('#element').tooltip('destroy')
Add small overlays of content, like those on the iPad, to any element for housing secondary information. Hover over the button to trigger the popover. Requires Tooltip to be included.
Four options are available: top, right, bottom, and left aligned.
Sed posuere consectetur est at lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.
Sed posuere consectetur est at lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.
Sed posuere consectetur est at lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.
Sed posuere consectetur est at lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum.
No markup shown as popovers are generated from JavaScript and content within a data
attribute.
Enable popovers via JavaScript:
$('#example').popover(options)
Options can be passed via data attributes or JavaScript. For data attributes, append the option name to data-
, as in data-animation=""
.
Name | type | default | description |
---|---|---|---|
animation | boolean | true | apply a css fade transition to the tooltip |
html | boolean | false | Insert html into the popover. If false, jquery's text method will be used to insert content into the dom. Use text if you're worried about XSS attacks. |
placement | string | function | 'right' | how to position the popover - top | bottom | left | right |
selector | string | false | if a selector is provided, tooltip objects will be delegated to the specified targets |
trigger | string | 'click' | how popover is triggered - click | hover | focus | manual |
title | string | function | '' | default title value if `title` attribute isn't present |
content | string | function | '' | default content value if `data-content` attribute isn't present |
delay | number | object | 0 |
delay showing and hiding the popover (ms) - does not apply to manual trigger type If a number is supplied, delay is applied to both hide/show Object structure is: |
container | string | false | false |
Appends the popover to a specific element |
For performance reasons, the Tooltip and Popover data-apis are opt in. If you would like to use them just specify a selector option.
Initializes popovers for an element collection.
Reveals an elements popover.
$('#element').popover('show')
Hides an elements popover.
$('#element').popover('hide')
Toggles an elements popover.
$('#element').popover('toggle')
Hides and destroys an element's popover.
$('#element').popover('destroy')
Add dismiss functionality to all alert messages with this plugin.
Change this and that and try again. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Cras mattis consectetur purus sit amet fermentum.
Enable dismissal of an alert via JavaScript:
$(".alert").alert()
Just add data-dismiss="alert"
to your close button to automatically give an alert close functionality.
<a class="close" data-dismiss="alert" href="#">×</a>
Wraps all alerts with close functionality. To have your alerts animate out when closed, make sure they have the .fade
and .in
class already applied to them.
Closes an alert.
$(".alert").alert('close')
Bootstrap's alert class exposes a few events for hooking into alert functionality.
Event | Description |
---|---|
close | This event fires immediately when the close instance method is called. |
closed | This event is fired when the alert has been closed (will wait for css transitions to complete). |
$('#my-alert').bind('closed', function () { // do something… })
Do more with buttons. Control button states or create groups of buttons for more components like toolbars.
Add data-loading-text="Loading..."
to use a loading state on a button.
<button type="button" class="btn btn-primary" data-loading-text="Loading...">Loading state</button>
Add data-toggle="button"
to activate toggling on a single button.
<button type="button" class="btn btn-primary" data-toggle="button">Single Toggle</button>
Add data-toggle="buttons-checkbox"
for checkbox style toggling on btn-group.
<div class="btn-group" data-toggle="buttons-checkbox"> <button type="button" class="btn btn-primary">Left</button> <button type="button" class="btn btn-primary">Middle</button> <button type="button" class="btn btn-primary">Right</button> </div>
Add data-toggle="buttons-radio"
for radio style toggling on btn-group.
<div class="btn-group" data-toggle="buttons-radio"> <button type="button" class="btn btn-primary">Left</button> <button type="button" class="btn btn-primary">Middle</button> <button type="button" class="btn btn-primary">Right</button> </div>
Enable buttons via JavaScript:
$('.nav-tabs').button()
Data attributes are integral to the button plugin. Check out the example code below for the various markup types.
None
Toggles push state. Gives the button the appearance that it has been activated.
data-toggle
attribute.
<button type="button" class="btn" data-toggle="button" >…</button>
Sets button state to loading - disables button and swaps text to loading text. Loading text should be defined on the button element using the data attribute data-loading-text
.
<button type="button" class="btn" data-loading-text="loading stuff..." >...</button>
autocomplete="off"
.
Resets button state - swaps text to original text.
Resets button state - swaps text to any data defined text state.
<button type="button" class="btn" data-complete-text="finished!" >...</button> <script> $('.btn').button('complete') </script>
Get base styles and flexible support for collapsible components like accordions and navigation.
* Requires the Transitions plugin to be included.
Using the collapse plugin, we built a simple accordion style widget:
<div class="accordion" id="accordion2"> <div class="accordion-group"> <div class="accordion-heading"> <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseOne"> Collapsible Group Item #1 </a> </div> <div id="collapseOne" class="accordion-body collapse in"> <div class="accordion-inner"> Anim pariatur cliche... </div> </div> </div> <div class="accordion-group"> <div class="accordion-heading"> <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseTwo"> Collapsible Group Item #2 </a> </div> <div id="collapseTwo" class="accordion-body collapse"> <div class="accordion-inner"> Anim pariatur cliche... </div> </div> </div> </div> ...
You can also use the plugin without the accordion markup. Make a button toggle the expanding and collapsing of another element.
<button type="button" class="btn btn-danger" data-toggle="collapse" data-target="#demo"> simple collapsible </button> <div id="demo" class="collapse in"> … </div>
Just add data-toggle="collapse"
and a data-target
to element to automatically assign control of a collapsible element. The data-target
attribute accepts a css selector to apply the collapse to. Be sure to add the class collapse
to the collapsible element. If you'd like it to default open, add the additional class in
.
To add accordion-like group management to a collapsible control, add the data attribute data-parent="#selector"
. Refer to the demo to see this in action.
Enable manually with:
$(".collapse").collapse()
Options can be passed via data attributes or JavaScript. For data attributes, append the option name to data-
, as in data-parent=""
.
Name | type | default | description |
---|---|---|---|
parent | selector | false | If selector then all collapsible elements under the specified parent will be closed when this collapsible item is shown. (similar to traditional accordion behavior) |
toggle | boolean | true | Toggles the collapsible element on invocation |
Activates your content as a collapsible element. Accepts an optional options object
.
$('#myCollapsible').collapse({ toggle: false })
Toggles a collapsible element to shown or hidden.
Shows a collapsible element.
Hides a collapsible element.
Bootstrap's collapse class exposes a few events for hooking into collapse functionality.
Event | Description |
---|---|
show | This event fires immediately when the show instance method is called. |
shown | This event is fired when a collapse element has been made visible to the user (will wait for css transitions to complete). |
hide |
This event is fired immediately when the hide method has been called.
|
hidden | This event is fired when a collapse element has been hidden from the user (will wait for css transitions to complete). |
$('#myCollapsible').on('hidden', function () { // do something… })
The slideshow below shows a generic plugin and component for cycling through elements like a carousel.
<div id="myCarousel" class="carousel slide"> <ol class="carousel-indicators"> <li data-target="#myCarousel" data-slide-to="0" class="active"></li> <li data-target="#myCarousel" data-slide-to="1"></li> <li data-target="#myCarousel" data-slide-to="2"></li> </ol> <!-- Carousel items --> <div class="carousel-inner"> <div class="active item">…</div> <div class="item">…</div> <div class="item">…</div> </div> <!-- Carousel nav --> <a class="carousel-control left" href="#myCarousel" data-slide="prev">‹</a> <a class="carousel-control right" href="#myCarousel" data-slide="next">›</a> </div>
Use data attributes to easily control the position of the carousel. data-slide
accepts the keywords prev
or next
, which alters the slide position relative to it's current position. Alternatively, use data-slide-to
to pass a raw slide index to the carousel data-slide-to="2"
, which jump's the slide position to a particular index beginning with 0
.
Call carousel manually with:
$('.carousel').carousel()
Options can be passed via data attributes or JavaScriptz. For data attributes, append the option name to data-
, as in data-interval=""
.
Name | type | default | description |
---|---|---|---|
interval | number | 5000 | The amount of time to delay between automatically cycling an item. If false, carousel will not automatically cycle. |
pause | string | "hover" | Pauses the cycling of the carousel on mouseenter and resumes the cycling of the carousel on mouseleave. |
Initializes the carousel with an optional options object
and starts cycling through items.
$('.carousel').carousel({ interval: 2000 })
Cycles through the carousel items from left to right.
Stops the carousel from cycling through items.
Cycles the carousel to a particular frame (0 based, similar to an array).
Cycles to the previous item.
Cycles to the next item.
Bootstrap's carousel class exposes two events for hooking into carousel functionality.
Event | Description |
---|---|
slide | This event fires immediately when the slide instance method is invoked. |
slid | This event is fired when the carousel has completed its slide transition. |
A basic, easily extended plugin for quickly creating elegant typeaheads with any form text input.
<input type="text" data-provide="typeahead">
You'll want to set autocomplete="off"
to prevent default browser menus from appearing over the Bootstrap typeahead dropdown.
Add data attributes to register an element with typeahead functionality as shown in the example above.
Call the typeahead manually with:
$('.typeahead').typeahead()
Options can be passed via data attributes or JavaScript. For data attributes, append the option name to data-
, as in data-source=""
.
Name | type | default | description |
---|---|---|---|
source | array, function | [ ] | The data source to query against. May be an array of strings or a function. The function is passed two arguments, the query value in the input field and the process callback. The function may be used synchronously by returning the data source directly or asynchronously via the process callback's single argument. |
items | number | 8 | The max number of items to display in the dropdown. |
minLength | number | 1 | The minimum character length needed before triggering autocomplete suggestions |
matcher | function | case insensitive | The method used to determine if a query matches an item. Accepts a single argument, the item against which to test the query. Access the current query with this.query . Return a boolean true if query is a match. |
sorter | function | exact match, case sensitive, case insensitive |
Method used to sort autocomplete results. Accepts a single argument items and has the scope of the typeahead instance. Reference the current query with this.query . |
updater | function | returns selected item | The method used to return selected item. Accepts a single argument, the item and has the scope of the typeahead instance. |
highlighter | function | highlights all default matches | Method used to highlight autocomplete results. Accepts a single argument item and has the scope of the typeahead instance. Should return html. |
Initializes an input with a typeahead.
Toggleable, contextual menu for displaying lists of links. Made interactive with the dropdown JavaScript plugin.
<ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu"> <li><a tabindex="-1" href="#">Action</a></li> <li><a tabindex="-1" href="#">Another action</a></li> <li><a tabindex="-1" href="#">Something else here</a></li> <li class="divider"></li> <li><a tabindex="-1" href="#">Separated link</a></li> </ul>
Looking at just the dropdown menu, here's the required HTML. You need to wrap the dropdown's trigger and the dropdown menu within .dropdown
, or another element that declares position: relative;
. Then just create the menu.
<div class="dropdown"> <!-- Link or button to toggle dropdown --> <ul class="dropdown-menu" role="menu" aria-labelledby="dLabel"> <li><a tabindex="-1" href="#">Action</a></li> <li><a tabindex="-1" href="#">Another action</a></li> <li><a tabindex="-1" href="#">Something else here</a></li> <li class="divider"></li> <li><a tabindex="-1" href="#">Separated link</a></li> </ul> </div>
Align menus to the right and add include additional levels of dropdowns.
Add .pull-right
to a .dropdown-menu
to right align the dropdown menu.
<ul class="dropdown-menu pull-right" role="menu" aria-labelledby="dLabel"> ... </ul>
Add .disabled
to a <li>
in the dropdown to disable the link.
<ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu"> <li><a tabindex="-1" href="#">Regular link</a></li> <li class="disabled"><a tabindex="-1" href="#">Disabled link</a></li> <li><a tabindex="-1" href="#">Another link</a></li> </ul>
Two basic options, along with two more specific variations.
Wrap a series of buttons with .btn
in .btn-group
.
<div class="btn-group"> <button class="btn">Left</button> <button class="btn">Middle</button> <button class="btn">Right</button> </div>
Combine sets of <div class="btn-group">
into a <div class="btn-toolbar">
for more complex components.
<div class="btn-toolbar"> <div class="btn-group"> ... </div> </div>
Make a set of buttons appear vertically stacked rather than horizontally.
<div class="btn-group btn-group-vertical"> ... </div>
Button groups can also function as radios, where only one button may be active, or checkboxes, where any number of buttons may be active. View the JavaScript docs for that.
Heads up! Buttons with dropdowns must be individually wrapped in their own .btn-group
within a .btn-toolbar
for proper rendering.
Use any button to trigger a dropdown menu by placing it within a .btn-group
and providing the proper menu markup.
<div class="btn-group"> <a class="btn dropdown-toggle" data-toggle="dropdown" href="#"> Action <span class="caret"></span> </a> <ul class="dropdown-menu"> <!-- dropdown menu links --> </ul> </div>
Button dropdowns work at any size: .btn-large
, .btn-small
, or .btn-mini
.
Button dropdowns require the Bootstrap dropdown plugin to function.
In some cases—like mobile—dropdown menus will extend outside the viewport. You need to resolve the alignment manually or with custom JavaScript.
Building on the button group styles and markup, we can easily create a split button. Split buttons feature a standard action on the left and a dropdown toggle on the right with contextual links.
<div class="btn-group"> <button class="btn">Action</button> <button class="btn dropdown-toggle" data-toggle="dropdown"> <span class="caret"></span> </button> <ul class="dropdown-menu"> <!-- dropdown menu links --> </ul> </div>
Utilize the extra button classes .btn-mini
, .btn-small
, or .btn-large
for sizing.
<div class="btn-group"> <button class="btn btn-mini">Action</button> <button class="btn btn-mini dropdown-toggle" data-toggle="dropdown"> <span class="caret"></span> </button> <ul class="dropdown-menu"> <!-- dropdown menu links --> </ul> </div>
Dropdown menus can also be toggled from the bottom up by adding a single class to the immediate parent of .dropdown-menu
. It will flip the direction of the .caret
and reposition the menu itself to move from the bottom up instead of top down.
<div class="btn-group dropup"> <button class="btn">Dropup</button> <button class="btn dropdown-toggle" data-toggle="dropdown"> <span class="caret"></span> </button> <ul class="dropdown-menu"> <!-- dropdown menu links --> </ul> </div>
All nav components here—tabs, pills, and lists—share the same base markup and styles through the .nav
class.
Take a regular <ul>
of links and add .nav-tabs
:
<ul class="nav nav-tabs"> <li class="active"> <a href="#">Home</a> </li> <li><a href="#">...</a></li> <li><a href="#">...</a></li> </ul>
Take that same HTML, but use .nav-pills
instead:
<ul class="nav nav-pills"> <li class="active"> <a href="#">Home</a> </li> <li><a href="#">...</a></li> <li><a href="#">...</a></li> </ul>
For any nav component (tabs, pills, or list), add .disabled
for gray links and no hover effects. Links will remain clickable, however, unless you remove the href
attribute. Alternatively, you could implement custom JavaScript to prevent those clicks.
<ul class="nav nav-pills"> ... <li class="disabled"><a href="#">Home</a></li> ... </ul>
To align nav links, use the .pull-left
or .pull-right
utility classes. Both classes will add a CSS float in the specified direction.
As tabs and pills are horizontal by default, just add a second class, .nav-stacked
, to make them appear vertically stacked.
<ul class="nav nav-tabs nav-stacked"> ... </ul>
<ul class="nav nav-pills nav-stacked"> ... </ul>
Add dropdown menus with a little extra HTML and the dropdowns JavaScript plugin.
<ul class="nav nav-tabs"> <li class="dropdown"> <a class="dropdown-toggle" data-toggle="dropdown" href="#"> Dropdown <b class="caret"></b> </a> <ul class="dropdown-menu"> <!-- links --> </ul> </li> </ul>
<ul class="nav nav-pills"> <li class="dropdown"> <a class="dropdown-toggle" data-toggle="dropdown" href="#"> Dropdown <b class="caret"></b> </a> <ul class="dropdown-menu"> <!-- links --> </ul> </li> </ul>
A simple and easy way to build groups of nav links with optional headers. They're best used in sidebars like the Finder in OS X.
Take a list of links and add class="nav nav-list"
:
<ul class="nav nav-list"> <li class="nav-header">List header</li> <li class="active"><a href="#">Home</a></li> <li><a href="#">Library</a></li> ... </ul>
Note
For nesting within a nav list, include class="nav nav-list"
on any nested <ul>
.
Add a horizontal divider by creating an empty list item with the class .divider
, like so:
<ul class="nav nav-list"> ... <li class="divider"></li> ... </ul>
Bring your tabs to life with a simple plugin to toggle between content via tabs. Bootstrap integrates tabbable tabs in four styles: top (default), right, bottom, and left.
To make tabs tabbable, create a .tab-pane
with unique ID for every tab and wrap them in .tab-content
.
<div class="tabbable"> <!-- Only required for left/right tabs --> <ul class="nav nav-tabs"> <li class="active"><a href="#tab1" data-toggle="tab">Section 1</a></li> <li><a href="#tab2" data-toggle="tab">Section 2</a></li> </ul> <div class="tab-content"> <div class="tab-pane active" id="tab1"> <p>I'm in Section 1.</p> </div> <div class="tab-pane" id="tab2"> <p>Howdy, I'm in Section 2.</p> </div> </div> </div>
To make tabs fade in, add .fade
to each .tab-pane
.
All tabbable tabs are powered by our lightweight jQuery plugin. Read more about how to bring tabbable tabs to life on the JavaScript docs page.
Flip the order of the HTML and add a class to put tabs on the bottom.
<div class="tabbable tabs-below"> <div class="tab-content"> ... </div> <ul class="nav nav-tabs"> ... </ul> </div>
Swap the class to put tabs on the left.
<div class="tabbable tabs-left"> <ul class="nav nav-tabs"> ... </ul> <div class="tab-content"> ... </div> </div>
Swap the class to put tabs on the right.
<div class="tabbable tabs-right"> <ul class="nav nav-tabs"> ... </ul> <div class="tab-content"> ... </div> </div>
To start, navbars are static (not fixed to the top) and include support for a project name and basic navigation. Place one anywhere within a .container
, which sets the width of your site and content.
<div class="navbar"> <div class="navbar-inner"> <a class="brand" href="#">Title</a> <ul class="nav"> <li class="active"><a href="#">Home</a></li> <li><a href="#">Link</a></li> <li><a href="#">Link</a></li> </ul> </div> </div>
A simple link to show your brand or project name only requires an anchor tag.
<a class="brand" href="#">Project name</a>
Nav items are simple to add via unordered lists.
<ul class="nav"> <li class="active"> <a href="#">Home</a> </li> <li><a href="#">Link</a></li> <li><a href="#">Link</a></li> </ul>
You can easily add dividers to your nav links with an empty list item and a simple class. Just add this between links:
<ul class="nav"> ... <li class="divider-vertical"></li> ... </ul>
To properly style and position a form within the navbar, add the appropriate classes as shown below. For a default form, include .navbar-form
and either .pull-left
or .pull-right
to properly align it.
<form class="navbar-form pull-left"> <input type="text" class="span2"> <button type="submit" class="btn">Submit</button> </form>
For a more customized search form, add .navbar-search
to the form
and .search-query
to the input for specialized styles in the navbar.
<form class="navbar-search pull-left"> <input type="text" class="search-query" placeholder="Search"> </form>
Align nav links, search form, or text, use the .pull-left
or .pull-right
utility classes. Both classes will add a CSS float in the specified direction.
Add dropdowns and dropups to the nav with a bit of markup and the dropdowns JavaScript plugin.
<ul class="nav"> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown"> Account <b class="caret"></b> </a> <ul class="dropdown-menu"> ... </ul> </li> </ul>
Visit the JavaScript dropdowns documentation for more markup and information on calling dropdowns.
Wrap strings of text in an element with .navbar-text
, usually on a <p>
tag for proper leading and color.
Fix the navbar to the top or bottom of the viewport with an additional class on the outermost div, .navbar
.
Add .navbar-fixed-top
and remember to account for the hidden area underneath it by adding at least 40px padding
to the <body>
. Be sure to add this after the core Bootstrap CSS and before the optional responsive CSS.
<div class="navbar navbar-fixed-top"> ... </div>
Add .navbar-fixed-bottom
instead.
<div class="navbar navbar-fixed-bottom"> ... </div>
Create a full-width navbar that scrolls away with the page by adding .navbar-static-top
. Unlike the .navbar-fixed-top
class, you do not need to change any padding on the body
.
<div class="navbar navbar-static-top"> ... </div>
To implement a collapsing responsive navbar, wrap your navbar content in a containing div, .nav-collapse.collapse
, and add the navbar toggle button, .btn-navbar
.
<div class="navbar"> <div class="navbar-inner"> <div class="container"> <!-- .btn-navbar is used as the toggle for collapsed navbar content --> <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </a> <!-- Be sure to leave the brand out there if you want it shown --> <a class="brand" href="#">Project name</a> <!-- Everything you want hidden at 940px or less, place within here --> <div class="nav-collapse collapse"> <!-- .nav, .navbar-search, .navbar-form, etc --> </div> </div> </div> </div>
Modify the look of the navbar by adding .navbar-inverse
.
<div class="navbar navbar-inverse"> ... </div>
A single example shown as it might be displayed across multiple pages.
<ul class="breadcrumb"> <li><a href="#">Home</a> <span class="divider">/</span></li> <li><a href="#">Library</a> <span class="divider">/</span></li> <li class="active">Data</li> </ul>
Simple pagination inspired by Rdio, great for apps and search results. The large block is hard to miss, easily scalable, and provides large click areas.
<div class="pagination"> <ul> <li><a href="#">Prev</a></li> <li><a href="#">1</a></li> <li><a href="#">2</a></li> <li><a href="#">3</a></li> <li><a href="#">4</a></li> <li><a href="#">5</a></li> <li><a href="#">Next</a></li> </ul> </div>
Links are customizable for different circumstances. Use .disabled
for unclickable links and .active
to indicate the current page.
<div class="pagination"> <ul> <li class="disabled"><a href="#">«</a></li> <li class="active"><a href="#">1</a></li> ... </ul> </div>
You can optionally swap out active or disabled anchors for spans to remove click functionality while retaining intended styles.
<div class="pagination"> <ul> <li class="disabled"><span>«</span></li> <li class="active"><span>1</span></li> ... </ul> </div>
Fancy larger or smaller pagination? Add .pagination-large
, .pagination-small
, or .pagination-mini
for additional sizes.
<div class="pagination pagination-large"> <ul> ... </ul> </div> <div class="pagination"> <ul> ... </ul> </div> <div class="pagination pagination-small"> <ul> ... </ul> </div> <div class="pagination pagination-mini"> <ul> ... </ul> </div>
Add one of two optional classes to change the alignment of pagination links: .pagination-centered
and .pagination-right
.
<div class="pagination pagination-centered"> ... </div>
<div class="pagination pagination-right"> ... </div>
Quick previous and next links for simple pagination implementations with light markup and styles. It's great for simple sites like blogs or magazines.
By default, the pager centers links.
<ul class="pager"> <li><a href="#">Previous</a></li> <li><a href="#">Next</a></li> </ul>
Alternatively, you can align each link to the sides:
<ul class="pager"> <li class="previous"> <a href="#">← Older</a> </li> <li class="next"> <a href="#">Newer →</a> </li> </ul>
Pager links also use the general .disabled
utility class from the pagination.
<ul class="pager"> <li class="previous disabled"> <a href="#">← Older</a> </li> ... </ul>
Labels | Markup |
---|---|
Default |
<span class="label">Default</span>
|
Success |
<span class="label label-success">Success</span>
|
Warning |
<span class="label label-warning">Warning</span>
|
Important |
<span class="label label-important">Important</span>
|
Info |
<span class="label label-info">Info</span>
|
Inverse |
<span class="label label-inverse">Inverse</span>
|
Name | Example | Markup |
---|---|---|
Default | 1 |
<span class="badge">1</span>
|
Success | 2 |
<span class="badge badge-success">2</span>
|
Warning | 4 |
<span class="badge badge-warning">4</span>
|
Important | 6 |
<span class="badge badge-important">6</span>
|
Info | 8 |
<span class="badge badge-info">8</span>
|
Inverse | 10 |
<span class="badge badge-inverse">10</span>
|
For easy implementation, labels and badges will simply collapse (via CSS's :empty
selector) when no content exists within.
A lightweight, flexible component to showcase key content on your site. It works well on marketing and content-heavy sites.
This is a simple hero unit, a simple jumbotron-style component for calling extra attention to featured content or information.
<div class="hero-unit"> <h1>Heading</h1> <p>Tagline</p> <p> <a class="btn btn-primary btn-large"> Learn more </a> </p> </div>
A simple shell for an h1
to appropriately space out and segment sections of content on a page. It can utilize the h1
's default small
, element as well most other components (with additional styles).
<div class="page-header"> <h1>Example page header <small>Subtext for header</small></h1> </div>
By default, Bootstrap's thumbnails are designed to showcase linked images with minimal required markup.
With a bit of extra markup, it's possible to add any kind of HTML content like headings, paragraphs, or buttons into thumbnails.
Thumbnails (previously .media-grid
up until v1.4) are great for grids of photos or videos, image search results, retail products, portfolios, and much more. They can be links or static content.
Thumbnail markup is simple—a ul
with any number of li
elements is all that is required. It's also super flexible, allowing for any type of content with just a bit more markup to wrap your contents.
Lastly, the thumbnails component uses existing grid system classes—like .span2
or .span3
—for control of thumbnail dimensions.
As mentioned previously, the required markup for thumbnails is light and straightforward. Here's a look at the default setup for linked images:
<ul class="thumbnails"> <li class="span4"> <a href="#" class="thumbnail"> <img data-src="/holder.js/300x200" alt=""> </a> </li> ... </ul>
For custom HTML content in thumbnails, the markup changes slightly. To allow block level content anywhere, we swap the <a>
for a <div>
like so:
<ul class="thumbnails"> <li class="span4"> <div class="thumbnail"> <img data-src="/holder.js/300x200" alt=""> <h3>Thumbnail label</h3> <p>Thumbnail caption...</p> </div> </li> ... </ul>
Explore all your options with the various grid classes available to you. You can also mix and match different sizes.
Wrap any text and an optional dismiss button in .alert
for a basic warning alert message.
<div class="alert"> <button type="button" class="close" data-dismiss="alert">×</button> <strong>Warning!</strong> Best check yo self, you're not looking too good. </div>
Mobile Safari and Mobile Opera browsers, in addition to the data-dismiss="alert"
attribute, require an href="#"
for the dismissal of alerts when using an <a>
tag.
<a href="#" class="close" data-dismiss="alert">×</a>
Alternatively, you may use a <button>
element with the data attribute, which we have opted to do for our docs. When using <button>
, you must include type="button"
or your forms may not submit.
<button type="button" class="close" data-dismiss="alert">×</button>
Use the alerts jQuery plugin for quick and easy dismissal of alerts.
For longer messages, increase the padding on the top and bottom of the alert wrapper by adding .alert-block
.
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.
<div class="alert alert-block"> <button type="button" class="close" data-dismiss="alert">×</button> <h4>Warning!</h4> Best check yo self, you're not... </div>
Add optional classes to change an alert's connotation.
<div class="alert alert-error"> ... </div>
<div class="alert alert-success"> ... </div>
<div class="alert alert-info"> ... </div>
Default progress bar with a vertical gradient.
<div class="progress"> <div class="bar" style="width: 60%;"></div> </div>
Uses a gradient to create a striped effect. Not available in IE7-8.
<div class="progress progress-striped"> <div class="bar" style="width: 20%;"></div> </div>
Add .active
to .progress-striped
to animate the stripes right to left. Not available in all versions of IE.
<div class="progress progress-striped active"> <div class="bar" style="width: 40%;"></div> </div>
Place multiple bars into the same .progress
to stack them.
<div class="progress"> <div class="bar bar-success" style="width: 35%;"></div> <div class="bar bar-warning" style="width: 20%;"></div> <div class="bar bar-danger" style="width: 10%;"></div> </div>
Progress bars use some of the same button and alert classes for consistent styles.
<div class="progress progress-info"> <div class="bar" style="width: 20%"></div> </div> <div class="progress progress-success"> <div class="bar" style="width: 40%"></div> </div> <div class="progress progress-warning"> <div class="bar" style="width: 60%"></div> </div> <div class="progress progress-danger"> <div class="bar" style="width: 80%"></div> </div>
Similar to the solid colors, we have varied striped progress bars.
<div class="progress progress-info progress-striped"> <div class="bar" style="width: 20%"></div> </div> <div class="progress progress-success progress-striped"> <div class="bar" style="width: 40%"></div> </div> <div class="progress progress-warning progress-striped"> <div class="bar" style="width: 60%"></div> </div> <div class="progress progress-danger progress-striped"> <div class="bar" style="width: 80%"></div> </div>
Progress bars use CSS3 gradients, transitions, and animations to achieve all their effects. These features are not supported in IE7-9 or older versions of Firefox.
Versions earlier than Internet Explorer 10 and Opera 12 do not support animations.
Abstract object styles for building various types of components (like blog comments, Tweets, etc) that feature a left- or right-aligned image alongside textual content.
The default media allow to float a media object (images, video, audio) to the left or right of a content block.
<div class="media"> <a class="pull-left" href="#"> <img class="media-object" data-src="/holder.js/64x64"> </a> <div class="media-body"> <h4 class="media-heading">Media heading</h4> ... <!-- Nested media object --> <div class="media"> ... </div> </div> </div>
With a bit of extra markup, you can use media inside list (useful for comment threads or articles lists).
Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin commodo. Cras purus odio, vestibulum in vulputate at, tempus viverra turpis.
<ul class="media-list"> <li class="media"> <a class="pull-left" href="#"> <img class="media-object" data-src="/holder.js/64x64"> </a> <div class="media-body"> <h4 class="media-heading">Media heading</h4> ... <!-- Nested media object --> <div class="media"> ... </div> </div> </li> </ul>
Use the well as a simple effect on an element to give it an inset effect.
<div class="well"> ... </div>
Control padding and rounded corners with two optional modifier classes.
<div class="well well-large"> ... </div>
<div class="well well-small"> ... </div>
Use the generic close icon for dismissing content like modals and alerts.
<button class="close">×</button>
iOS devices require an href="#"
for click events if you would rather use an anchor.
<a class="close" href="#">×</a>
Simple, focused classes for small display or behavior tweaks.
Float an element left
class="pull-left"
.pull-left { float: left; }
Float an element right
class="pull-right"
.pull-right { float: right; }
Change an element's color to #999
class="muted"
.muted { color: #999; }
Clear the float
on any element
class="clearfix"
.clearfix { *zoom: 1; &:before, &:after { display: table; content: ""; } &:after { clear: both; } }
All HTML headings, <h1>
through <h6>
are available.
Bootstrap's global default font-size
is 14px, with a line-height
of 20px. This is applied to the <body>
and all paragraphs. In addition, <p>
(paragraphs) receive a bottom margin of half their line-height (10px by default).
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.
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.
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>...</p>
Make a paragraph stand out by adding .lead
.
Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Duis mollis, est non commodo luctus.
<p class="lead">...</p>
The typographic scale is based on two LESS variables in variables.less: @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 simple math to create the margins, paddings, and line-heights of all our type and more. Customize them and Bootstrap adapts.
Make use of HTML's default emphasis tags with lightweight styles.
<small>
For de-emphasizing inline or blocks of text, use the small tag.
This line of text is meant to be treated as fine print.
<p> <small>This line of text is meant to be treated as fine print.</small> </p>
For emphasizing a snippet of text with a heavier font-weight.
The following snippet of text is rendered as bold text.
<strong>rendered as bold text</strong>
For emphasizing a snippet of text with italics.
The following snippet of text is rendered as italicized text.
<em>rendered as italicized text</em>
Heads up! Feel free to use <b>
and <i>
in HTML5. <b>
is meant to highlight words or phrases without conveying additional importance while <i>
is mostly for voice, technical terms, etc.
Easily realign text to components with text alignment classes.
Left aligned text.
Center aligned text.
Right aligned text.
<p class="text-left">Left aligned text.</p> <p class="text-center">Center aligned text.</p> <p class="text-right">Right aligned text.</p>
Convey meaning through color with a handful of emphasis utility classes.
Fusce dapibus, tellus ac cursus commodo, tortor mauris nibh.
Etiam porta sem malesuada magna mollis euismod.
Donec ullamcorper nulla non metus auctor fringilla.
Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis.
Duis mollis, est non commodo luctus, nisi erat porttitor ligula.
<p class="muted">Fusce dapibus, tellus ac cursus commodo, tortor mauris nibh.</p> <p class="text-warning">Etiam porta sem malesuada magna mollis euismod.</p> <p class="text-error">Donec ullamcorper nulla non metus auctor fringilla.</p> <p class="text-info">Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis.</p> <p class="text-success">Duis mollis, est non commodo luctus, nisi erat porttitor ligula.</p>
Stylized implementation of HTML's <abbr>
element for abbreviations and acronyms to show the expanded version on hover. Abbreviations with a title
attribute have a light dotted bottom border and a help cursor on hover, providing additional context on hover.
<abbr>
For expanded text on long hover of an abbreviation, include the title
attribute.
An abbreviation of the word attribute is attr.
<abbr title="attribute">attr</abbr>
<abbr class="initialism">
Add .initialism
to an abbreviation for a slightly smaller font-size.
HTML is the best thing since sliced bread.
<abbr title="HyperText Markup Language" class="initialism">HTML</abbr>
Present contact information for the nearest ancestor or the entire body of work.
<address>
Preserve formatting by ending all lines with <br>
.
<address> <strong>Twitter, Inc.</strong><br> 795 Folsom Ave, Suite 600<br> San Francisco, CA 94107<br> <abbr title="Phone">P:</abbr> (123) 456-7890 </address> <address> <strong>Full Name</strong><br> <a href="mailto:#">first.last#example.com</a> </address>
For quoting blocks of content from another source within your document.
Wrap <blockquote>
around any HTML as the quote. For straight quotes we recommend a <p>
.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.
<blockquote> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p> </blockquote>
Style and content changes for simple variations on a standard blockquote.
Add <small>
tag for identifying the source. Wrap the name of the source work in <cite>
.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.
Someone famous in Source Title
<blockquote> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.</p> <small>Someone famous <cite title="Source Title">Source Title</cite></small> </blockquote>
Use .pull-right
for a floated, right-aligned blockquote.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer posuere erat a ante.
Someone famous in Source Title
<blockquote class="pull-right"> ... </blockquote>
A list of items in which the order does not explicitly matter.
<ul> <li>...</li> </ul>
A list of items in which the order does explicitly matter.
<ol> <li>...</li> </ol>
Remove the default list-style
and left padding on list items (immediate children only).
<ul class="unstyled"> <li>...</li> </ul>
Place all list items on a single line with inline-block
and some light padding.
<ul class="inline"> <li>...</li> </ul>
A list of terms with their associated descriptions.
<dl> <dt>...</dt> <dd>...</dd> </dl>
Make terms and descriptions in <dl>
line up side-by-side.
<dl class="dl-horizontal"> <dt>...</dt> <dd>...</dd> </dl>
Heads up!
Horizontal description lists will truncate terms that are too long to fit in the left column fix text-overflow
. In narrower viewports, they will change to the default stacked layout.
Wrap inline snippets of code with <code>
.
<section>
should be wrapped as inline.
For example, <code><section></code> should be wrapped as inline.
Use <pre>
for multiple lines of code. Be sure to escape any angle brackets in the code for proper rendering.
<p>Sample text here...</p>
<pre> <p>Sample text here...</p> </pre>
Heads up! Be sure to keep code within <pre>
tags as close to the left as possible; it will render all tabs.
You may optionally add the .pre-scrollable
class which will set a max-height of 350px and provide a y-axis scrollbar.
For basic styling—light padding and only horizontal dividers—add the base class .table
to any <table>
.
# | First Name | Last Name | Username |
---|---|---|---|
1 | Mark | Otto | @mdo |
2 | Jacob | Thornton | @fat |
3 | Larry | the Bird |
<table class="table"> … </table>
Add any of the following classes to the .table
base class.
.table-striped
Adds zebra-striping to any table row within the <tbody>
via the :nth-child
CSS selector (not available in IE7-8).
# | First Name | Last Name | Username |
---|---|---|---|
1 | Mark | Otto | @mdo |
2 | Jacob | Thornton | @fat |
3 | Larry | the Bird |
<table class="table table-striped"> … </table>
.table-bordered
Add borders and rounded corners to the table.
# | First Name | Last Name | Username |
---|---|---|---|
1 | Mark | Otto | @mdo |
Mark | Otto | @TwBootstrap | |
2 | Jacob | Thornton | @fat |
3 | Larry the Bird |
<table class="table table-bordered"> … </table>
.table-hover
Enable a hover state on table rows within a <tbody>
.
# | First Name | Last Name | Username |
---|---|---|---|
1 | Mark | Otto | @mdo |
2 | Jacob | Thornton | @fat |
3 | Larry the Bird |
<table class="table table-hover"> … </table>
.table-condensed
Makes tables more compact by cutting cell padding in half.
# | First Name | Last Name | Username |
---|---|---|---|
1 | Mark | Otto | @mdo |
2 | Jacob | Thornton | @fat |
3 | Larry the Bird |
<table class="table table-condensed"> … </table>
Use contextual classes to color table rows.
Class | Description |
---|---|
.success
|
Indicates a successful or positive action. |
.error
|
Indicates a dangerous or potentially negative action. |
.warning
|
Indicates a warning that might need attention. |
.info
|
Used as an alternative to the default styles. |
# | Product | Payment Taken | Status |
---|---|---|---|
1 | TB - Monthly | 01/04/2012 | Approved |
2 | TB - Monthly | 02/04/2012 | Declined |
3 | TB - Monthly | 03/04/2012 | Pending |
4 | TB - Monthly | 04/04/2012 | Call in to confirm |
... <tr class="success"> <td>1</td> <td>TB - Monthly</td> <td>01/04/2012</td> <td>Approved</td> </tr> ...
List of supported table HTML elements and how they should be used.
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 |
<caption>
|
Description or summary of what the table holds, especially useful for screen readers |
<table> <caption>...</caption> <thead> <tr> <th>...</th> <th>...</th> </tr> </thead> <tbody> <tr> <td>...</td> <td>...</td> </tr> </tbody> </table>
Individual form controls receive styling, but without any required base class on the <form>
or large changes in markup. Results in stacked, left-aligned labels on top of form controls.
<form> <fieldset> <legend>Legend</legend> <label>Label name</label> <input type="text" placeholder="Type something…"> <span class="help-block">Example block-level help text here.</span> <label class="checkbox"> <input type="checkbox"> Check me out </label> <button type="submit" class="btn">Submit</button> </fieldset> </form>
Included with Bootstrap are three optional form layouts for common use cases.
Add .form-search
to the form and .search-query
to the <input>
for an extra-rounded text input.
<form class="form-search"> <input type="text" class="input-medium search-query"> <button type="submit" class="btn">Search</button> </form>
Add .form-inline
for left-aligned labels and inline-block controls for a compact layout.
<form class="form-inline"> <input type="text" class="input-small" placeholder="Email"> <input type="password" class="input-small" placeholder="Password"> <label class="checkbox"> <input type="checkbox"> Remember me </label> <button type="submit" class="btn">Sign in</button> </form>
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:
.form-horizontal
to the form.control-group
.control-label
to the label.controls
for proper alignment<form class="form-horizontal"> <div class="control-group"> <label class="control-label" for="inputEmail">Email</label> <div class="controls"> <input type="text" id="inputEmail" placeholder="Email"> </div> </div> <div class="control-group"> <label class="control-label" for="inputPassword">Password</label> <div class="controls"> <input type="password" id="inputPassword" placeholder="Password"> </div> </div> <div class="control-group"> <div class="controls"> <label class="checkbox"> <input type="checkbox"> Remember me </label> <button type="submit" class="btn">Sign in</button> </div> </div> </form>
Examples of standard form controls supported in an example form layout.
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.
Requires the use of a specified type
at all times.
<input type="text" placeholder="Text input">
Form control which supports multiple lines of text. Change rows
attribute as necessary.
<textarea rows="3"></textarea>
Checkboxes are for selecting one or several options in a list while radios are for selecting one option from many.
<label class="checkbox"> <input type="checkbox" value=""> Option one is this and that—be sure to include why it's great </label> <label class="radio"> <input type="radio" name="optionsRadios" id="optionsRadios1" value="option1" checked> Option one is this and that—be sure to include why it's great </label> <label class="radio"> <input type="radio" name="optionsRadios" id="optionsRadios2" value="option2"> Option two can be something else and selecting it will deselect option one </label>
Add the .inline
class to a series of checkboxes or radios for controls appear on the same line.
<label class="checkbox inline"> <input type="checkbox" id="inlineCheckbox1" value="option1"> 1 </label> <label class="checkbox inline"> <input type="checkbox" id="inlineCheckbox2" value="option2"> 2 </label> <label class="checkbox inline"> <input type="checkbox" id="inlineCheckbox3" value="option3"> 3 </label>
Use the default option or specify a multiple="multiple"
to show multiple options at once.
<select> <option>1</option> <option>2</option> <option>3</option> <option>4</option> <option>5</option> </select> <select multiple="multiple"> <option>1</option> <option>2</option> <option>3</option> <option>4</option> <option>5</option> </select>
Adding on top of existing browser controls, Bootstrap includes other useful form components.
Add text or buttons before or after any text-based input. Do note that select
elements are not supported here.
Wrap an .add-on
and an input
with one of two classes to prepend or append text to an input.
<div class="input-prepend"> <span class="add-on">@</span> <input class="span2" id="prependedInput" type="text" placeholder="Username"> </div> <div class="input-append"> <input class="span2" id="appendedInput" type="text"> <span class="add-on">.00</span> </div>
Use both classes and two instances of .add-on
to prepend and append an input.
<div class="input-prepend input-append"> <span class="add-on">$</span> <input class="span2" id="appendedPrependedInput" type="text"> <span class="add-on">.00</span> </div>
Instead of a <span>
with text, use a .btn
to attach a button (or two) to an input.
<div class="input-append"> <input class="span2" id="appendedInputButton" type="text"> <button class="btn" type="button">Go!</button> </div>
<div class="input-append"> <input class="span2" id="appendedInputButtons" type="text"> <button class="btn" type="button">Search</button> <button class="btn" type="button">Options</button> </div>
<div class="input-append"> <input class="span2" id="appendedDropdownButton" type="text"> <div class="btn-group"> <button class="btn dropdown-toggle" data-toggle="dropdown"> Action <span class="caret"></span> </button> <ul class="dropdown-menu"> ... </ul> </div> </div>
<div class="input-prepend"> <div class="btn-group"> <button class="btn dropdown-toggle" data-toggle="dropdown"> Action <span class="caret"></span> </button> <ul class="dropdown-menu"> ... </ul> </div> <input class="span2" id="prependedDropdownButton" type="text"> </div>
<div class="input-prepend input-append"> <div class="btn-group"> <button class="btn dropdown-toggle" data-toggle="dropdown"> Action <span class="caret"></span> </button> <ul class="dropdown-menu"> ... </ul> </div> <input class="span2" id="appendedPrependedDropdownButton" type="text"> <div class="btn-group"> <button class="btn dropdown-toggle" data-toggle="dropdown"> Action <span class="caret"></span> </button> <ul class="dropdown-menu"> ... </ul> </div> </div>
<form> <div class="input-prepend"> <div class="btn-group">...</div> <input type="text"> </div> <div class="input-append"> <input type="text"> <div class="btn-group">...</div> </div> </form>
<form class="form-search"> <div class="input-append"> <input type="text" class="span2 search-query"> <button type="submit" class="btn">Search</button> </div> <div class="input-prepend"> <button type="submit" class="btn">Search</button> <input type="text" class="span2 search-query"> </div> </form>
Use relative sizing classes like .input-large
or match your inputs to the grid column sizes using .span*
classes.
Make any <input>
or <textarea>
element behave like a block level element.
<input class="input-block-level" type="text" placeholder=".input-block-level">
<input class="input-mini" type="text" placeholder=".input-mini"> <input class="input-small" type="text" placeholder=".input-small"> <input class="input-medium" type="text" placeholder=".input-medium"> <input class="input-large" type="text" placeholder=".input-large"> <input class="input-xlarge" type="text" placeholder=".input-xlarge"> <input class="input-xxlarge" type="text" placeholder=".input-xxlarge">
Heads up! In future versions, we'll be altering the use of these relative input classes to match our button sizes. For example, .input-large
will increase the padding and font-size of an input.
Use .span1
to .span12
for inputs that match the same sizes of the grid columns.
<input class="span1" type="text" placeholder=".span1"> <input class="span2" type="text" placeholder=".span2"> <input class="span3" type="text" placeholder=".span3"> <select class="span1"> ... </select> <select class="span2"> ... </select> <select class="span3"> ... </select>
For multiple grid inputs per line, use the .controls-row
modifier class for proper spacing. It floats the inputs to collapse white-space, sets the proper margins, and clears the float.
<div class="controls"> <input class="span5" type="text" placeholder=".span5"> </div> <div class="controls controls-row"> <input class="span4" type="text" placeholder=".span4"> <input class="span1" type="text" placeholder=".span1"> </div> ...
Present data in a form that's not editable without using actual form markup.
<span class="input-xlarge uneditable-input">Some value here</span>
End a form with a group of actions (buttons). When placed within a .form-actions
, the buttons will automatically indent to line up with the form controls.
<div class="form-actions"> <button type="submit" class="btn btn-primary">Save changes</button> <button type="button" class="btn">Cancel</button> </div>
Inline and block level support for help text that appears around form controls.
<input type="text"><span class="help-inline">Inline help text</span>
<input type="text"><span class="help-block">A longer block of help text that breaks onto a new line and may extend beyond one line.</span>
Provide feedback to users or visitors with basic feedback states on form controls and labels.
We remove the default outline
styles on some form controls and apply a box-shadow
in its place for :focus
.
<input class="input-xlarge" id="focusedInput" type="text" value="This is focused...">
Style inputs via default browser functionality with :invalid
. Specify a type
, add the required
attribute if the field is not optional, and (if applicable) specify a pattern
.
This is not available in versions of Internet Explorer 7-9 due to lack of support for CSS pseudo selectors.
<input class="span3" type="email" required>
Add the disabled
attribute on an input to prevent user input and trigger a slightly different look.
<input class="input-xlarge" id="disabledInput" type="text" placeholder="Disabled input here..." disabled>
Bootstrap includes validation styles for error, warning, info, and success messages. To use, add the appropriate class to the surrounding .control-group
.
<div class="control-group warning"> <label class="control-label" for="inputWarning">Input with warning</label> <div class="controls"> <input type="text" id="inputWarning"> <span class="help-inline">Something may have gone wrong</span> </div> </div> <div class="control-group error"> <label class="control-label" for="inputError">Input with error</label> <div class="controls"> <input type="text" id="inputError"> <span class="help-inline">Please correct the error</span> </div> </div> <div class="control-group info"> <label class="control-label" for="inputInfo">Input with info</label> <div class="controls"> <input type="text" id="inputInfo"> <span class="help-inline">Username is already taken</span> </div> </div> <div class="control-group success"> <label class="control-label" for="inputSuccess">Input with success</label> <div class="controls"> <input type="text" id="inputSuccess"> <span class="help-inline">Woohoo!</span> </div> </div>
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 for the best rendering.
Button | class="" | Description |
---|---|---|
btn |
Standard gray button with gradient | |
btn btn-primary |
Provides extra visual weight and identifies the primary action in a set of buttons | |
btn btn-info |
Used as an alternative to the default styles | |
btn btn-success |
Indicates a successful or positive action | |
btn btn-warning |
Indicates caution should be taken with this action | |
btn btn-danger |
Indicates a dangerous or potentially negative action | |
btn btn-inverse |
Alternate dark gray button, not tied to a semantic action or use | |
btn btn-link |
Deemphasize a button by making it look like a link while maintaining button behavior |
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.
Fancy larger or smaller buttons? Add .btn-large
, .btn-small
, or .btn-mini
for additional sizes.
<p> <button class="btn btn-large btn-primary" type="button">Large button</button> <button class="btn btn-large" type="button">Large button</button> </p> <p> <button class="btn btn-primary" type="button">Default button</button> <button class="btn" type="button">Default button</button> </p> <p> <button class="btn btn-small btn-primary" type="button">Small button</button> <button class="btn btn-small" type="button">Small button</button> </p> <p> <button class="btn btn-mini btn-primary" type="button">Mini button</button> <button class="btn btn-mini" type="button">Mini button</button> </p>
Create block level buttons—those that span the full width of a parent— by adding .btn-block
.
<button class="btn btn-large btn-block btn-primary" type="button">Block level button</button> <button class="btn btn-large btn-block" type="button">Block level button</button>
Make buttons look unclickable by fading them back 50%.
Add the .disabled
class to <a>
buttons.
<a href="#" class="btn btn-large btn-primary disabled">Primary link</a> <a href="#" class="btn btn-large disabled">Link</a>
Heads up!
We use .disabled
as a utility class here, similar to the common .active
class, so no prefix is required. Also, this class is only for aesthetic; you must use custom JavaScript to disable links here.
Add the disabled
attribute to <button>
buttons.
<button type="button" class="btn btn-large btn-primary disabled" disabled="disabled">Primary button</button> <button type="button" class="btn btn-large" disabled>Button</button>
Use the .btn
class on an <a>
, <button>
, or <input>
element.
<a class="btn" href="/">Link</a> <button class="btn" type="submit">Button</button> <input class="btn" type="button" value="Input"> <input class="btn" type="submit" value="Submit">
As a best practice, try to match the element for your context to ensure matching cross-browser rendering. If you have an input
, use an <input type="submit">
for your button.
Add classes to an <img>
element to easily style images in any project.
<img src="/....." class="img-rounded"> <img src="/....." class="img-circle"> <img src="/....." class="img-polaroid">
Heads up! .img-rounded
and .img-circle
do not work in IE7-8 due to lack of border-radius
support.
140 icons in sprite form, available in dark gray (default) and white, provided by Glyphicons.
Glyphicons Halflings are normally not available for free, but an arrangement between Bootstrap and the Glyphicons creators have made this possible at no cost to you as developers. As a thank you, we ask you to include an optional link back to Glyphicons whenever practical.
All icons require an <i>
tag with a unique class, prefixed with icon-
. 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. We will specifically enforce this class on hover and active states for nav and dropdown links.
<i class="icon-search icon-white"></i>
Heads up!
When using beside strings of text, as in buttons or nav links, be sure to leave a space after the <i>
tag for proper spacing.
Use them in buttons, button groups for a toolbar, navigation, or prepended form inputs.
<div class="btn-toolbar"> <div class="btn-group"> <a class="btn" href="#"><i class="icon-align-left"></i></a> <a class="btn" href="#"><i class="icon-align-center"></i></a> <a class="btn" href="#"><i class="icon-align-right"></i></a> <a class="btn" href="#"><i class="icon-align-justify"></i></a> </div> </div>
<div class="btn-group"> <a class="btn btn-primary" href="#"><i class="icon-user icon-white"></i> User</a> <a class="btn btn-primary dropdown-toggle" data-toggle="dropdown" href="#"><span class="caret"></span></a> <ul class="dropdown-menu"> <li><a href="#"><i class="icon-pencil"></i> Edit</a></li> <li><a href="#"><i class="icon-trash"></i> Delete</a></li> <li><a href="#"><i class="icon-ban-circle"></i> Ban</a></li> <li class="divider"></li> <li><a href="#"><i class="i"></i> Make admin</a></li> </ul> </div>
<a class="btn btn-large" href="#"><i class="icon-star"></i> Star</a> <a class="btn btn-small" href="#"><i class="icon-star"></i> Star</a> <a class="btn btn-mini" href="#"><i class="icon-star"></i> Star</a>
<ul class="nav nav-list"> <li class="active"><a href="#"><i class="icon-home icon-white"></i> Home</a></li> <li><a href="#"><i class="icon-book"></i> Library</a></li> <li><a href="#"><i class="icon-pencil"></i> Applications</a></li> <li><a href="#"><i class="i"></i> Misc</a></li> </ul>
<div class="control-group"> <label class="control-label" for="inputIcon">Email address</label> <div class="controls"> <div class="input-prepend"> <span class="add-on"><i class="icon-envelope"></i></span> <input class="span2" id="inputIcon" type="text"> </div> </div> </div>