Documentation and examples for Bootstrap’s logo and brand usage guidelines.
+
+
+
Have a need for Bootstrap’s brand resources? Great! We have only a few guidelines we follow, and in turn ask you to follow as well. These guidelines were inspired by MailChimp’s Brand Assets.
+
Mark and logo
+
Use either the Bootstrap mark (a capital B) or the standard logo (just Bootstrap). It should always appear in San Francisco Display Semibold. Do not use the Twitter bird in association with Bootstrap.
+
+
+
+
+
+
+
+
+
+
+ Bootstrap
+
+
+ Bootstrap
+
+
+
Download mark
+
Download the Bootstrap mark in one of three styles, each available as an SVG file. Right click, Save as.
+
+
+
+
+
+
+
+
+
+
+
+
Name
+
The project and framework should always be referred to as Bootstrap. No Twitter before it, no capital s, and no abbreviations except for one, a capital B.
+
+
+ Bootstrap
+ Right
+
+
+ BootStrap
+ Wrong
+
+
+ Twitter Bootstrap
+ Wrong
+
+
+
Colors
+
Our docs and branding use a handful of primary colors to differentiate what is Bootstrap from what is in Bootstrap. In other words, if it’s purple, it’s representative of Bootstrap.
Commonly asked questions about Bootstrap’s open source license.
+
+
+
Bootstrap is released under the MIT license and is copyright 2021 Twitter. Boiled down to smaller chunks, it can be described with the following conditions.
+
It requires you to:
+
+
Keep the license and copyright notice included in Bootstrap’s CSS and JavaScript files when you use them in your works
+
+
It permits you to:
+
+
Freely download and use Bootstrap, in whole or in part, for personal, private, company internal, or commercial purposes
+
Use Bootstrap in packages or distributions that you create
+
Modify the source code
+
Grant a sublicense to modify and distribute Bootstrap to third parties not included in the license
+
+
It forbids you to:
+
+
Hold the authors and license owners liable for damages as Bootstrap is provided without warranty
+
Hold the creators or copyright holders of Bootstrap liable
+
Redistribute any piece of Bootstrap without proper attribution
+
Use any marks owned by Twitter in any way that might state or imply that Twitter endorses your distribution
+
Use any marks owned by Twitter in any way that might state or imply that you created the Twitter software in question
+
+
It does not require you to:
+
+
Include the source of Bootstrap itself, or of any modifications you may have made to it, in any redistribution you may assemble that includes it
+
Submit changes that you make to Bootstrap back to the Bootstrap project (though such feedback is encouraged)
Learn more about the team maintaining Bootstrap, how and why the project started, and how to get involved.
+
+
+
Team
+
Bootstrap is maintained by a small team of developers on GitHub. We’re actively looking to grow this team and would love to hear from you if you’re excited about CSS at scale, writing and maintaining vanilla JavaScript plugins, and improving build tooling processes for frontend code.
+
History
+
Originally created by a designer and a developer at Twitter, Bootstrap has become one of the most popular front-end frameworks and open source projects in the world.
+
Bootstrap was created at Twitter in mid-2010 by @mdo and @fat. Prior to being an open-sourced framework, Bootstrap was known as Twitter Blueprint. A few months into development, Twitter held its first Hack Week and the project exploded as developers of all skill levels jumped in without any external guidance. It served as the style guide for internal tools development at the company for over a year before its public release, and continues to do so today.
+
Originally released on , we’ve since had over twenty releases, including two major rewrites with v2 and v3. With Bootstrap 2, we added responsive functionality to the entire framework as an optional stylesheet. Building on that with Bootstrap 3, we rewrote the library once more to make it responsive by default with a mobile first approach.
+
With Bootstrap 4, we once again rewrote the project to account for two key architectural changes: a migration to Sass and the move to CSS’s flexbox. Our intention is to help in a small way to move the web development community forward by pushing for newer CSS properties, fewer dependencies, and new technologies across more modern browsers.
+
Get involved
+
Get involved with Bootstrap development by opening an issue or submitting a pull request. Read our contributing guidelines for information on how we develop.
An overview of the founding team and core contributors to Bootstrap.
+
+
+
Bootstrap is maintained by the founding team and a small group of invaluable core contributors, with the massive support and involvement of our community.
Get involved with Bootstrap development by opening an issue or submitting a pull request. Read our contributing guidelines for information on how we develop.
Links to community-translated Bootstrap documentation sites.
+
+
+
Community members have translated Bootstrap’s documentation into various languages. None are officially supported and they may not always be up to date.
This page is outdated and is no longer applicable to the latest versions of Bootstrap. It’s here purely for historical purposes now and will be removed in our next major release.
+
+
+
Bootstrap currently works around several outstanding browser bugs in major browsers to deliver the best cross-browser experience possible. Some bugs, like those listed below, cannot be solved by us.
+
We publicly list browser bugs that are impacting us here, in the hopes of expediting the process of fixing them. For information on Bootstrap’s browser compatibility, see our browser compatibility docs.
There are several features specified in Web standards which would allow us to make Bootstrap more robust, elegant, or performant, but aren’t yet implemented in certain browsers, thus preventing us from taking advantage of them.
+
We publicly list these “most wanted” feature requests here, in the hopes of expediting the process of getting them implemented.
+
+
+
+
Browser(s)
+
Summary of feature
+
Upstream issue(s)
+
Bootstrap issue(s)
+
+
+
+
+
Edge
+
Focusable elements should fire focus event / receive :focus styling when they receive Narrator/accessibility focus
Provide contextual feedback messages for typical user actions with the handful of available and flexible alert messages.
+
+
+
Examples
+
Alerts are available for any length of text, as well as an optional dismiss button. For proper styling, use one of the eight required contextual classes (e.g., .alert-success). For inline dismissal, use the alerts jQuery plugin.
+
+
+
+ A simple primary alert—check it out!
+
+
+ A simple secondary alert—check it out!
+
+
+ A simple success alert—check it out!
+
+
+ A simple danger alert—check it out!
+
+
+ A simple warning alert—check it out!
+
+
+ A simple info alert—check it out!
+
+
+ A simple light alert—check it out!
+
+
+ A simple dark alert—check it out!
+
+
<divclass="alert alert-primary"role="alert">
+ A simple primary alert—check it out!
+</div>
+<divclass="alert alert-secondary"role="alert">
+ A simple secondary alert—check it out!
+</div>
+<divclass="alert alert-success"role="alert">
+ A simple success alert—check it out!
+</div>
+<divclass="alert alert-danger"role="alert">
+ A simple danger alert—check it out!
+</div>
+<divclass="alert alert-warning"role="alert">
+ A simple warning alert—check it out!
+</div>
+<divclass="alert alert-info"role="alert">
+ A simple info alert—check it out!
+</div>
+<divclass="alert alert-light"role="alert">
+ A simple light alert—check it out!
+</div>
+<divclass="alert alert-dark"role="alert">
+ A simple dark alert—check it out!
+</div>
+
+
Conveying meaning to assistive technologies
+
Using color to add meaning only provides a visual indication, which will not be conveyed to users of assistive technologies – such as screen readers. Ensure that information denoted by the color is either obvious from the content itself (e.g. the visible text), or is included through alternative means, such as additional text hidden with the .sr-only class.
+
+
+
Link color
+
Use the .alert-link utility class to quickly provide matching colored links within any alert.
+
+
+
+ A simple primary alert with an example link. Give it a click if you like.
+
+
+ A simple secondary alert with an example link. Give it a click if you like.
+
+
+ A simple success alert with an example link. Give it a click if you like.
+
+
+ A simple danger alert with an example link. Give it a click if you like.
+
+
+ A simple warning alert with an example link. Give it a click if you like.
+
+
+ A simple info alert with an example link. Give it a click if you like.
+
+
+ A simple light alert with an example link. Give it a click if you like.
+
+
+ A simple dark alert with an example link. Give it a click if you like.
+
+
<divclass="alert alert-primary"role="alert">
+ A simple primary alert with <ahref="#"class="alert-link">an example link</a>. Give it a click if you like.
+</div>
+<divclass="alert alert-secondary"role="alert">
+ A simple secondary alert with <ahref="#"class="alert-link">an example link</a>. Give it a click if you like.
+</div>
+<divclass="alert alert-success"role="alert">
+ A simple success alert with <ahref="#"class="alert-link">an example link</a>. Give it a click if you like.
+</div>
+<divclass="alert alert-danger"role="alert">
+ A simple danger alert with <ahref="#"class="alert-link">an example link</a>. Give it a click if you like.
+</div>
+<divclass="alert alert-warning"role="alert">
+ A simple warning alert with <ahref="#"class="alert-link">an example link</a>. Give it a click if you like.
+</div>
+<divclass="alert alert-info"role="alert">
+ A simple info alert with <ahref="#"class="alert-link">an example link</a>. Give it a click if you like.
+</div>
+<divclass="alert alert-light"role="alert">
+ A simple light alert with <ahref="#"class="alert-link">an example link</a>. Give it a click if you like.
+</div>
+<divclass="alert alert-dark"role="alert">
+ A simple dark alert with <ahref="#"class="alert-link">an example link</a>. Give it a click if you like.
+</div>
+
Additional content
+
Alerts can also contain additional HTML elements like headings, paragraphs and dividers.
+
+
+
Well done!
+
Aww yeah, you successfully read this important alert message. This example text is going to run a bit longer so that you can see how spacing within an alert works with this kind of content.
+
+
Whenever you need to, be sure to use margin utilities to keep things nice and tidy.
+
+
<divclass="alert alert-success"role="alert">
+ <h4class="alert-heading">Well done!</h4>
+ <p>Aww yeah, you successfully read this important alert message. This example text is going to run a bit longer so that you can see how spacing within an alert works with this kind of content.</p>
+ <hr>
+ <pclass="mb-0">Whenever you need to, be sure to use margin utilities to keep things nice and tidy.</p>
+</div>
+
Dismissing
+
Using the alert JavaScript plugin, it’s possible to dismiss any alert inline. Here’s how:
+
+
Be sure you’ve loaded the alert plugin, or the compiled Bootstrap JavaScript.
+
If you’re building our JavaScript from source, it requires util.js. The compiled version includes this.
+
Add a dismiss button and the .alert-dismissible class, which adds extra padding to the right of the alert and positions the .close button.
+
On the dismiss button, add the data-dismiss="alert" attribute, which triggers the JavaScript functionality. Be sure to use the <button> element with it for proper behavior across all devices.
+
To animate alerts when dismissing them, be sure to add the .fade and .show classes.
+
+
You can see this in action with a live demo:
+
+
+ Holy guacamole! You should check in on some of those fields below.
+
+
+
<divclass="alert alert-warning alert-dismissible fade show"role="alert">
+ <strong>Holy guacamole!</strong> You should check in on some of those fields below.
+ <buttontype="button"class="close"data-dismiss="alert"aria-label="Close">
+ <spanaria-hidden="true">×</span>
+ </button>
+</div>
+
JavaScript behavior
+
Triggers
+
Enable dismissal of an alert via JavaScript:
+
$('.alert').alert()
+
Or with data attributes on a button within the alert, as demonstrated above:
Note that closing an alert will remove it from the DOM.
+
Methods
+
+
+
+
Method
+
Description
+
+
+
+
+
$().alert()
+
Makes an alert listen for click events on descendant elements which have the data-dismiss="alert" attribute. (Not necessary when using the data-api’s auto-initialization.)
+
+
+
$().alert('close')
+
Closes an alert by removing it from the DOM. If the .fade and .show classes are present on the element, the alert will fade out before it is removed.
+
+
+
$().alert('dispose')
+
Destroys an element’s alert.
+
+
+
+
$('.alert').alert('close')
+
Events
+
Bootstrap’s alert plugin exposes a few events for hooking into alert functionality.
+
+
+
+
Event
+
Description
+
+
+
+
+
close.bs.alert
+
This event fires immediately when the close instance method is called.
+
+
+
closed.bs.alert
+
This event is fired when the alert has been closed (will wait for CSS transitions to complete).
+
+
+
+
$('#myAlert').on('closed.bs.alert',function(){
+ // do something...
+})
+
Note that depending on how they are used, badges may be confusing for users of screen readers and similar assistive technologies. While the styling of badges provides a visual cue as to their purpose, these users will simply be presented with the content of the badge. Depending on the specific situation, these badges may seem like random additional words or numbers at the end of a sentence, link, or button.
+
Unless the context is clear (as with the “Notifications” example, where it is understood that the “4” is the number of notifications), consider including additional context with a visually hidden piece of additional text.
Using color to add meaning only provides a visual indication, which will not be conveyed to users of assistive technologies – such as screen readers. Ensure that information denoted by the color is either obvious from the content itself (e.g. the visible text), or is included through alternative means, such as additional text hidden with the .sr-only class.
+
+
+
Pill badges
+
Use the .badge-pill modifier class to make badges more rounded (with a larger border-radius and additional horizontal padding). Useful if you miss the badges from v3.
Separators are automatically added in CSS through ::before and content. They can be changed by changing $breadcrumb-divider. The quote function is needed to generate the quotes around a string, so if you want > as separator, you can use this:
+
$breadcrumb-divider:quote(">");
+
It’s also possible to use a base64 embedded SVG icon:
The separator can be removed by setting $breadcrumb-divider to none:
+
$breadcrumb-divider:none;
+
Accessibility
+
Since breadcrumbs provide a navigation, it’s a good idea to add a meaningful label such as aria-label="breadcrumb" to describe the type of navigation provided in the <nav> element, as well as applying an aria-current="page" to the last item of the set to indicate that it represents the current page.
In order for assistive technologies (such as screen readers) to convey that a series of buttons is grouped, an appropriate role attribute needs to be provided. For button groups, this would be role="group", while toolbars should have a role="toolbar".
+
In addition, groups and toolbars should be given an explicit label, as most assistive technologies will otherwise not announce them, despite the presence of the correct role attribute. In the examples provided here, we use aria-label, but alternatives such as aria-labelledby can also be used.
+
+
+
+
Button toolbar
+
Combine sets of button groups into button toolbars for more complex components. Use utility classes as needed to space out groups, buttons, and more.
Feel free to mix input groups with button groups in your toolbars. Similar to the example above, you’ll likely need some utilities though to space things properly.
Instead of applying button sizing classes to every button in a group, just add .btn-group-* to each .btn-group, including each one when nesting multiple groups.
Using color to add meaning only provides a visual indication, which will not be conveyed to users of assistive technologies – such as screen readers. Ensure that information denoted by the color is either obvious from the content itself (e.g. the visible text), or is included through alternative means, such as additional text hidden with the .sr-only class.
+
+
+
Disable text wrapping
+
If you don’t want the button text to wrap, you can add the .text-nowrap class to the button. In Sass, you can set $btn-white-space: nowrap to disable text wrapping for each button.
+
Button tags
+
The .btn classes are designed to be used with the <button> element. However, you can also use these classes on <a> or <input> elements (though some browsers may apply a slightly different rendering).
+
When using button classes on <a> elements that are used to trigger in-page functionality (like collapsing content), rather than linking to new pages or sections within the current page, these links should be given a role="button" to appropriately convey their purpose to assistive technologies such as screen readers.
In need of a button, but not the hefty background colors they bring? Replace the default modifier classes with the .btn-outline-* ones to remove all background images and colors on any button.
+Some of the button styles use a relatively light foreground color, and should only be used on a dark background in order to have sufficient contrast.
+
+
+
Sizes
+
Fancy larger or smaller buttons? Add .btn-lg or .btn-sm for additional sizes.
Buttons will appear pressed (with a darker background, darker border, and inset shadow) when active. There’s no need to add a class to <button>s as they use a pseudo-class. However, you can still force the same active appearance with .active (and include the aria-pressed=“true” attribute) should you need to replicate the state programmatically.
Disabled buttons using the <a> element behave a bit different:
+
+
<a>s don’t support the disabled attribute, so you must add the .disabled class to make it visually appear disabled.
+
Some future-friendly styles are included to disable all pointer-events on anchor buttons. In browsers which support that property, you won’t see the disabled cursor at all.
+
Disabled buttons should include the aria-disabled="true" attribute to indicate the state of the element to assistive technologies.
The .disabled class uses pointer-events: none to try to disable the link functionality of <a>s, but that CSS property is not yet standardized. In addition, even in browsers that do support pointer-events: none, keyboard navigation remains unaffected, meaning that sighted keyboard users and users of assistive technologies will still be able to activate these links. So to be safe, add a tabindex="-1" attribute on these links (to prevent them from receiving keyboard focus) and use custom JavaScript to disable their functionality.
+
+
+
Button plugin
+
Do more with buttons. Control button states or create groups of buttons for more components like toolbars.
+
Toggle states
+
Add data-toggle="button" to toggle a button’s active state. If you’re pre-toggling a button, you must manually add the .active class andaria-pressed="true" to the <button>.
+
+
+
<buttontype="button"class="btn btn-primary"data-toggle="button"aria-pressed="false">
+ Single toggle
+</button>
+
Checkbox and radio buttons
+
Bootstrap’s .button styles can be applied to other elements, such as <label>s, to provide checkbox or radio style button toggling. Add data-toggle="buttons" to a .btn-group containing those modified buttons to enable their toggling behavior via JavaScript and add .btn-group-toggle to style the <input>s within your buttons. Note that you can create single input-powered buttons or groups of them.
+
The checked state for these buttons is only updated via click event on the button. If you use another method to update the input—e.g., with <input type="reset"> or by manually applying the input’s checked property—you’ll need to toggle .active on the <label> manually.
+
Note that pre-checked buttons require you to manually add the .active class to the input’s <label>.
Bootstrap’s cards provide a flexible and extensible content container with multiple variants and options.
+
+
+
About
+
A card is a flexible and extensible content container. It includes options for headers and footers, a wide variety of content, contextual background colors, and powerful display options. If you’re familiar with Bootstrap 3, cards replace our old panels, wells, and thumbnails. Similar functionality to those components is available as modifier classes for cards.
+
Example
+
Cards are built with as little markup and styles as possible, but still manage to deliver a ton of control and customization. Built with flexbox, they offer easy alignment and mix well with other Bootstrap components. They have no margin by default, so use spacing utilities as needed.
+
Below is an example of a basic card with mixed content and a fixed width. Cards have no fixed width to start, so they’ll naturally fill the full width of its parent element. This is easily customized with our various sizing options.
+
+
+
+
+
+
Card title
+
Some quick example text to build on the card title and make up the bulk of the card's content.
<divclass="card"style="width: 18rem;">
+ <imgsrc="..."class="card-img-top"alt="...">
+ <divclass="card-body">
+ <h5class="card-title">Card title</h5>
+ <pclass="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
+ <ahref="#"class="btn btn-primary">Go somewhere</a>
+ </div>
+</div>
+
Content types
+
Cards support a wide variety of content, including images, text, list groups, links, and more. Below are examples of what’s supported.
+
Body
+
The building block of a card is the .card-body. Use it whenever you need a padded section within a card.
+
+
+
+ This is some text within a card body.
+
+
+
<divclass="card">
+ <divclass="card-body">
+ This is some text within a card body.
+ </div>
+</div>
+
Titles, text, and links
+
Card titles are used by adding .card-title to a <h*> tag. In the same way, links are added and placed next to each other by adding .card-link to an <a> tag.
+
Subtitles are used by adding a .card-subtitle to a <h*> tag. If the .card-title and the .card-subtitle items are placed in a .card-body item, the card title and subtitle are aligned nicely.
+
+
+
+
Card title
+
Card subtitle
+
Some quick example text to build on the card title and make up the bulk of the card's content.
<divclass="card"style="width: 18rem;">
+ <divclass="card-body">
+ <h5class="card-title">Card title</h5>
+ <h6class="card-subtitle mb-2 text-muted">Card subtitle</h6>
+ <pclass="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
+ <ahref="#"class="card-link">Card link</a>
+ <ahref="#"class="card-link">Another link</a>
+ </div>
+</div>
+
Images
+
.card-img-top places an image to the top of the card. With .card-text, text can be added to the card. Text within .card-text can also be styled with the standard HTML tags.
+
+
+
+
+
+
Some quick example text to build on the card title and make up the bulk of the card's content.
+
+
+
<divclass="card"style="width: 18rem;">
+ <imgsrc="..."class="card-img-top"alt="...">
+ <divclass="card-body">
+ <pclass="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
+ </div>
+</div>
+
List groups
+
Create lists of content in a card with a flush list group.
+
+
+
+
An item
+
A second item
+
A third item
+
+
+
<divclass="card"style="width: 18rem;">
+ <ulclass="list-group list-group-flush">
+ <liclass="list-group-item">An item</li>
+ <liclass="list-group-item">A second item</li>
+ <liclass="list-group-item">A third item</li>
+ </ul>
+</div>
+
+
+
+ Featured
+
+
+
An item
+
A second item
+
A third item
+
+
+
<divclass="card"style="width: 18rem;">
+ <divclass="card-header">
+ Featured
+ </div>
+ <ulclass="list-group list-group-flush">
+ <liclass="list-group-item">An item</li>
+ <liclass="list-group-item">A second item</li>
+ <liclass="list-group-item">A third item</li>
+ </ul>
+</div>
Mix and match multiple content types to create the card you need, or throw everything in there. Shown below are image styles, blocks, text styles, and a list group—all wrapped in a fixed-width card.
+
+
+
+
+
+
Card title
+
Some quick example text to build on the card title and make up the bulk of the card's content.
<divclass="card"style="width: 18rem;">
+ <imgsrc="..."class="card-img-top"alt="...">
+ <divclass="card-body">
+ <h5class="card-title">Card title</h5>
+ <pclass="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
+ </div>
+ <ulclass="list-group list-group-flush">
+ <liclass="list-group-item">An item</li>
+ <liclass="list-group-item">A second item</li>
+ <liclass="list-group-item">A third item</li>
+ </ul>
+ <divclass="card-body">
+ <ahref="#"class="card-link">Card link</a>
+ <ahref="#"class="card-link">Another link</a>
+ </div>
+</div>
+
Header and footer
+
Add an optional header and/or footer within a card.
+
+
+
+ Featured
+
+
+
Special title treatment
+
With supporting text below as a natural lead-in to additional content.
<divclass="card text-center">
+ <divclass="card-header">
+ Featured
+ </div>
+ <divclass="card-body">
+ <h5class="card-title">Special title treatment</h5>
+ <pclass="card-text">With supporting text below as a natural lead-in to additional content.</p>
+ <ahref="#"class="btn btn-primary">Go somewhere</a>
+ </div>
+ <divclass="card-footer text-muted">
+ 2 days ago
+ </div>
+</div>
+
Sizing
+
Cards assume no specific width to start, so they’ll be 100% wide unless otherwise stated. You can change this as needed with custom CSS, grid classes, grid Sass mixins, or utilities.
+
Using grid markup
+
Using the grid, wrap cards in columns and rows as needed.
+
+
+
+
+
+
Special title treatment
+
With supporting text below as a natural lead-in to additional content.
Cards include a few options for working with images. Choose from appending “image caps” at either end of a card, overlaying images with card content, or simply embedding the image in a card.
+
Image caps
+
Similar to headers and footers, cards can include top and bottom “image caps”—images at the top or bottom of a card.
+
+
+
+
+
+
Card title
+
This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.
+
Last updated 3 mins ago
+
+
+
+
+
Card title
+
This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.
+
Last updated 3 mins ago
+
+
+
+
+
<divclass="card mb-3">
+ <imgsrc="..."class="card-img-top"alt="...">
+ <divclass="card-body">
+ <h5class="card-title">Card title</h5>
+ <pclass="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
+ <pclass="card-text"><smallclass="text-muted">Last updated 3 mins ago</small></p>
+ </div>
+</div>
+<divclass="card">
+ <divclass="card-body">
+ <h5class="card-title">Card title</h5>
+ <pclass="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
+ <pclass="card-text"><smallclass="text-muted">Last updated 3 mins ago</small></p>
+ </div>
+ <imgsrc="..."class="card-img-bottom"alt="...">
+</div>
+
Image overlays
+
Turn an image into a card background and overlay your card’s text. Depending on the image, you may or may not need additional styles or utilities.
+
+
+
+
+
+
Card title
+
This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.
+
Last updated 3 mins ago
+
+
+
<divclass="card bg-dark text-white">
+ <imgsrc="..."class="card-img"alt="...">
+ <divclass="card-img-overlay">
+ <h5class="card-title">Card title</h5>
+ <pclass="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
+ <pclass="card-text">Last updated 3 mins ago</p>
+ </div>
+</div>
+
+Note that content should not be larger than the height of the image. If content is larger than the image the content will be displayed outside the image.
+
+
+
Horizontal
+
Using a combination of grid and utility classes, cards can be made horizontal in a mobile-friendly and responsive way. In the example below, we remove the grid gutters with .no-gutters and use .col-md-* classes to make the card horizontal at the md breakpoint. Further adjustments may be needed depending on your card content.
+
+
+
+
+
+
+
+
+
+
Card title
+
This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.
+
Last updated 3 mins ago
+
+
+
+
+
<divclass="card mb-3"style="max-width: 540px;">
+ <divclass="row no-gutters">
+ <divclass="col-md-4">
+ <imgsrc="..."alt="...">
+ </div>
+ <divclass="col-md-8">
+ <divclass="card-body">
+ <h5class="card-title">Card title</h5>
+ <pclass="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
+ <pclass="card-text"><smallclass="text-muted">Last updated 3 mins ago</small></p>
+ </div>
+ </div>
+ </div>
+</div>
+
Card styles
+
Cards include various options for customizing their backgrounds, borders, and color.
Some quick example text to build on the card title and make up the bulk of the card's content.
+
+
+
+
Header
+
+
Secondary card title
+
Some quick example text to build on the card title and make up the bulk of the card's content.
+
+
+
+
Header
+
+
Success card title
+
Some quick example text to build on the card title and make up the bulk of the card's content.
+
+
+
+
Header
+
+
Danger card title
+
Some quick example text to build on the card title and make up the bulk of the card's content.
+
+
+
+
Header
+
+
Warning card title
+
Some quick example text to build on the card title and make up the bulk of the card's content.
+
+
+
+
Header
+
+
Info card title
+
Some quick example text to build on the card title and make up the bulk of the card's content.
+
+
+
+
Header
+
+
Light card title
+
Some quick example text to build on the card title and make up the bulk of the card's content.
+
+
+
+
Header
+
+
Dark card title
+
Some quick example text to build on the card title and make up the bulk of the card's content.
+
+
+
<divclass="card text-white bg-primary mb-3"style="max-width: 18rem;">
+ <divclass="card-header">Header</div>
+ <divclass="card-body">
+ <h5class="card-title">Primary card title</h5>
+ <pclass="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
+ </div>
+</div>
+<divclass="card text-white bg-secondary mb-3"style="max-width: 18rem;">
+ <divclass="card-header">Header</div>
+ <divclass="card-body">
+ <h5class="card-title">Secondary card title</h5>
+ <pclass="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
+ </div>
+</div>
+<divclass="card text-white bg-success mb-3"style="max-width: 18rem;">
+ <divclass="card-header">Header</div>
+ <divclass="card-body">
+ <h5class="card-title">Success card title</h5>
+ <pclass="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
+ </div>
+</div>
+<divclass="card text-white bg-danger mb-3"style="max-width: 18rem;">
+ <divclass="card-header">Header</div>
+ <divclass="card-body">
+ <h5class="card-title">Danger card title</h5>
+ <pclass="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
+ </div>
+</div>
+<divclass="card text-white bg-warning mb-3"style="max-width: 18rem;">
+ <divclass="card-header">Header</div>
+ <divclass="card-body">
+ <h5class="card-title">Warning card title</h5>
+ <pclass="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
+ </div>
+</div>
+<divclass="card text-white bg-info mb-3"style="max-width: 18rem;">
+ <divclass="card-header">Header</div>
+ <divclass="card-body">
+ <h5class="card-title">Info card title</h5>
+ <pclass="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
+ </div>
+</div>
+<divclass="card bg-light mb-3"style="max-width: 18rem;">
+ <divclass="card-header">Header</div>
+ <divclass="card-body">
+ <h5class="card-title">Light card title</h5>
+ <pclass="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
+ </div>
+</div>
+<divclass="card text-white bg-dark mb-3"style="max-width: 18rem;">
+ <divclass="card-header">Header</div>
+ <divclass="card-body">
+ <h5class="card-title">Dark card title</h5>
+ <pclass="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
+ </div>
+</div>
+
+
Conveying meaning to assistive technologies
+
Using color to add meaning only provides a visual indication, which will not be conveyed to users of assistive technologies – such as screen readers. Ensure that information denoted by the color is either obvious from the content itself (e.g. the visible text), or is included through alternative means, such as additional text hidden with the .sr-only class.
+
+
+
Border
+
Use border utilities to change just the border-color of a card. Note that you can put .text-{color} classes on the parent .card or a subset of the card’s contents as shown below.
+
+
+
+
Header
+
+
Primary card title
+
Some quick example text to build on the card title and make up the bulk of the card's content.
+
+
+
+
Header
+
+
Secondary card title
+
Some quick example text to build on the card title and make up the bulk of the card's content.
+
+
+
+
Header
+
+
Success card title
+
Some quick example text to build on the card title and make up the bulk of the card's content.
+
+
+
+
Header
+
+
Danger card title
+
Some quick example text to build on the card title and make up the bulk of the card's content.
+
+
+
+
Header
+
+
Warning card title
+
Some quick example text to build on the card title and make up the bulk of the card's content.
+
+
+
+
Header
+
+
Info card title
+
Some quick example text to build on the card title and make up the bulk of the card's content.
+
+
+
+
Header
+
+
Light card title
+
Some quick example text to build on the card title and make up the bulk of the card's content.
+
+
+
+
Header
+
+
Dark card title
+
Some quick example text to build on the card title and make up the bulk of the card's content.
+
+
+
<divclass="card border-primary mb-3"style="max-width: 18rem;">
+ <divclass="card-header">Header</div>
+ <divclass="card-body text-primary">
+ <h5class="card-title">Primary card title</h5>
+ <pclass="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
+ </div>
+</div>
+<divclass="card border-secondary mb-3"style="max-width: 18rem;">
+ <divclass="card-header">Header</div>
+ <divclass="card-body text-secondary">
+ <h5class="card-title">Secondary card title</h5>
+ <pclass="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
+ </div>
+</div>
+<divclass="card border-success mb-3"style="max-width: 18rem;">
+ <divclass="card-header">Header</div>
+ <divclass="card-body text-success">
+ <h5class="card-title">Success card title</h5>
+ <pclass="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
+ </div>
+</div>
+<divclass="card border-danger mb-3"style="max-width: 18rem;">
+ <divclass="card-header">Header</div>
+ <divclass="card-body text-danger">
+ <h5class="card-title">Danger card title</h5>
+ <pclass="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
+ </div>
+</div>
+<divclass="card border-warning mb-3"style="max-width: 18rem;">
+ <divclass="card-header">Header</div>
+ <divclass="card-body text-warning">
+ <h5class="card-title">Warning card title</h5>
+ <pclass="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
+ </div>
+</div>
+<divclass="card border-info mb-3"style="max-width: 18rem;">
+ <divclass="card-header">Header</div>
+ <divclass="card-body text-info">
+ <h5class="card-title">Info card title</h5>
+ <pclass="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
+ </div>
+</div>
+<divclass="card border-light mb-3"style="max-width: 18rem;">
+ <divclass="card-header">Header</div>
+ <divclass="card-body">
+ <h5class="card-title">Light card title</h5>
+ <pclass="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
+ </div>
+</div>
+<divclass="card border-dark mb-3"style="max-width: 18rem;">
+ <divclass="card-header">Header</div>
+ <divclass="card-body text-dark">
+ <h5class="card-title">Dark card title</h5>
+ <pclass="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
+ </div>
+</div>
+
Mixins utilities
+
You can also change the borders on the card header and footer as needed, and even remove their background-color with .bg-transparent.
+
+
+
Header
+
+
Success card title
+
Some quick example text to build on the card title and make up the bulk of the card's content.
+
+
+
+
<divclass="card border-success mb-3"style="max-width: 18rem;">
+ <divclass="card-header bg-transparent border-success">Header</div>
+ <divclass="card-body text-success">
+ <h5class="card-title">Success card title</h5>
+ <pclass="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
+ </div>
+ <divclass="card-footer bg-transparent border-success">Footer</div>
+</div>
+
Card layout
+
In addition to styling the content within cards, Bootstrap includes a few options for laying out series of cards. For the time being, these layout options are not yet responsive.
+
Card groups
+
Use card groups to render cards as a single, attached element with equal width and height columns. Card groups start off stacked and use display: flex; to become attached with uniform dimensions starting at the sm breakpoint.
+
+
+
+
+
+
+
Card title
+
This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.
+
Last updated 3 mins ago
+
+
+
+
+
+
+
Card title
+
This card has supporting text below as a natural lead-in to additional content.
+
Last updated 3 mins ago
+
+
+
+
+
+
+
Card title
+
This is a wider card with supporting text below as a natural lead-in to additional content. This card has even longer content than the first to show that equal height action.
+
Last updated 3 mins ago
+
+
+
+
<divclass="card-group">
+ <divclass="card">
+ <imgsrc="..."class="card-img-top"alt="...">
+ <divclass="card-body">
+ <h5class="card-title">Card title</h5>
+ <pclass="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
+ <pclass="card-text"><smallclass="text-muted">Last updated 3 mins ago</small></p>
+ </div>
+ </div>
+ <divclass="card">
+ <imgsrc="..."class="card-img-top"alt="...">
+ <divclass="card-body">
+ <h5class="card-title">Card title</h5>
+ <pclass="card-text">This card has supporting text below as a natural lead-in to additional content.</p>
+ <pclass="card-text"><smallclass="text-muted">Last updated 3 mins ago</small></p>
+ </div>
+ </div>
+ <divclass="card">
+ <imgsrc="..."class="card-img-top"alt="...">
+ <divclass="card-body">
+ <h5class="card-title">Card title</h5>
+ <pclass="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This card has even longer content than the first to show that equal height action.</p>
+ <pclass="card-text"><smallclass="text-muted">Last updated 3 mins ago</small></p>
+ </div>
+ </div>
+</div>
+
When using card groups with footers, their content will automatically line up.
+
+
+
+
+
+
+
Card title
+
This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.
+
+
+
+
+
+
+
+
Card title
+
This card has supporting text below as a natural lead-in to additional content.
+
+
+
+
+
+
+
+
Card title
+
This is a wider card with supporting text below as a natural lead-in to additional content. This card has even longer content than the first to show that equal height action.
+
+
+
+
+
<divclass="card-group">
+ <divclass="card">
+ <imgsrc="..."class="card-img-top"alt="...">
+ <divclass="card-body">
+ <h5class="card-title">Card title</h5>
+ <pclass="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
+ </div>
+ <divclass="card-footer">
+ <smallclass="text-muted">Last updated 3 mins ago</small>
+ </div>
+ </div>
+ <divclass="card">
+ <imgsrc="..."class="card-img-top"alt="...">
+ <divclass="card-body">
+ <h5class="card-title">Card title</h5>
+ <pclass="card-text">This card has supporting text below as a natural lead-in to additional content.</p>
+ </div>
+ <divclass="card-footer">
+ <smallclass="text-muted">Last updated 3 mins ago</small>
+ </div>
+ </div>
+ <divclass="card">
+ <imgsrc="..."class="card-img-top"alt="...">
+ <divclass="card-body">
+ <h5class="card-title">Card title</h5>
+ <pclass="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This card has even longer content than the first to show that equal height action.</p>
+ </div>
+ <divclass="card-footer">
+ <smallclass="text-muted">Last updated 3 mins ago</small>
+ </div>
+ </div>
+</div>
+
Card decks
+
Need a set of equal width and height cards that aren’t attached to one another? Use card decks.
+
+
+
+
+
+
+
Card title
+
This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.
+
Last updated 3 mins ago
+
+
+
+
+
+
+
Card title
+
This card has supporting text below as a natural lead-in to additional content.
+
Last updated 3 mins ago
+
+
+
+
+
+
+
Card title
+
This is a wider card with supporting text below as a natural lead-in to additional content. This card has even longer content than the first to show that equal height action.
+
Last updated 3 mins ago
+
+
+
+
<divclass="card-deck">
+ <divclass="card">
+ <imgsrc="..."class="card-img-top"alt="...">
+ <divclass="card-body">
+ <h5class="card-title">Card title</h5>
+ <pclass="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
+ <pclass="card-text"><smallclass="text-muted">Last updated 3 mins ago</small></p>
+ </div>
+ </div>
+ <divclass="card">
+ <imgsrc="..."class="card-img-top"alt="...">
+ <divclass="card-body">
+ <h5class="card-title">Card title</h5>
+ <pclass="card-text">This card has supporting text below as a natural lead-in to additional content.</p>
+ <pclass="card-text"><smallclass="text-muted">Last updated 3 mins ago</small></p>
+ </div>
+ </div>
+ <divclass="card">
+ <imgsrc="..."class="card-img-top"alt="...">
+ <divclass="card-body">
+ <h5class="card-title">Card title</h5>
+ <pclass="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This card has even longer content than the first to show that equal height action.</p>
+ <pclass="card-text"><smallclass="text-muted">Last updated 3 mins ago</small></p>
+ </div>
+ </div>
+</div>
+
Just like with card groups, card footers in decks will automatically line up.
+
+
+
+
+
+
+
Card title
+
This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.
+
+
+
+
+
+
+
+
Card title
+
This card has supporting text below as a natural lead-in to additional content.
+
+
+
+
+
+
+
+
Card title
+
This is a wider card with supporting text below as a natural lead-in to additional content. This card has even longer content than the first to show that equal height action.
+
+
+
+
+
<divclass="card-deck">
+ <divclass="card">
+ <imgsrc="..."class="card-img-top"alt="...">
+ <divclass="card-body">
+ <h5class="card-title">Card title</h5>
+ <pclass="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
+ </div>
+ <divclass="card-footer">
+ <smallclass="text-muted">Last updated 3 mins ago</small>
+ </div>
+ </div>
+ <divclass="card">
+ <imgsrc="..."class="card-img-top"alt="...">
+ <divclass="card-body">
+ <h5class="card-title">Card title</h5>
+ <pclass="card-text">This card has supporting text below as a natural lead-in to additional content.</p>
+ </div>
+ <divclass="card-footer">
+ <smallclass="text-muted">Last updated 3 mins ago</small>
+ </div>
+ </div>
+ <divclass="card">
+ <imgsrc="..."class="card-img-top"alt="...">
+ <divclass="card-body">
+ <h5class="card-title">Card title</h5>
+ <pclass="card-text">This is a wider card with supporting text below as a natural lead-in to additional content. This card has even longer content than the first to show that equal height action.</p>
+ </div>
+ <divclass="card-footer">
+ <smallclass="text-muted">Last updated 3 mins ago</small>
+ </div>
+ </div>
+</div>
+
Grid cards
+
Use the Bootstrap grid system and its .row-cols classes to control how many grid columns (wrapped around your cards) you show per row. For example, here’s .row-cols-1 laying out the cards on one column, and .row-cols-md-2 splitting four cards to equal width across multiple rows, from the medium breakpoint up.
+
+
+
+
+
+
+
+
Card title
+
This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.
+
+
+
+
+
+
+
+
+
Card title
+
This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.
+
+
+
+
+
+
+
+
+
Card title
+
This is a longer card with supporting text below as a natural lead-in to additional content.
+
+
+
+
+
+
+
+
+
Card title
+
This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.
+
+
+
+
+
<divclass="row row-cols-1 row-cols-md-2">
+ <divclass="col mb-4">
+ <divclass="card">
+ <imgsrc="..."class="card-img-top"alt="...">
+ <divclass="card-body">
+ <h5class="card-title">Card title</h5>
+ <pclass="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
+ </div>
+ </div>
+ </div>
+ <divclass="col mb-4">
+ <divclass="card">
+ <imgsrc="..."class="card-img-top"alt="...">
+ <divclass="card-body">
+ <h5class="card-title">Card title</h5>
+ <pclass="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
+ </div>
+ </div>
+ </div>
+ <divclass="col mb-4">
+ <divclass="card">
+ <imgsrc="..."class="card-img-top"alt="...">
+ <divclass="card-body">
+ <h5class="card-title">Card title</h5>
+ <pclass="card-text">This is a longer card with supporting text below as a natural lead-in to additional content.</p>
+ </div>
+ </div>
+ </div>
+ <divclass="col mb-4">
+ <divclass="card">
+ <imgsrc="..."class="card-img-top"alt="...">
+ <divclass="card-body">
+ <h5class="card-title">Card title</h5>
+ <pclass="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
+ </div>
+ </div>
+ </div>
+</div>
+
Change it to .row-cols-3 and you’ll see the fourth card wrap.
+
+
+
+
+
+
+
+
Card title
+
This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.
+
+
+
+
+
+
+
+
+
Card title
+
This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.
+
+
+
+
+
+
+
+
+
Card title
+
This is a longer card with supporting text below as a natural lead-in to additional content.
+
+
+
+
+
+
+
+
+
Card title
+
This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.
+
+
+
+
+
<divclass="row row-cols-1 row-cols-md-3">
+ <divclass="col mb-4">
+ <divclass="card">
+ <imgsrc="..."class="card-img-top"alt="...">
+ <divclass="card-body">
+ <h5class="card-title">Card title</h5>
+ <pclass="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
+ </div>
+ </div>
+ </div>
+ <divclass="col mb-4">
+ <divclass="card">
+ <imgsrc="..."class="card-img-top"alt="...">
+ <divclass="card-body">
+ <h5class="card-title">Card title</h5>
+ <pclass="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
+ </div>
+ </div>
+ </div>
+ <divclass="col mb-4">
+ <divclass="card">
+ <imgsrc="..."class="card-img-top"alt="...">
+ <divclass="card-body">
+ <h5class="card-title">Card title</h5>
+ <pclass="card-text">This is a longer card with supporting text below as a natural lead-in to additional content.</p>
+ </div>
+ </div>
+ </div>
+ <divclass="col mb-4">
+ <divclass="card">
+ <imgsrc="..."class="card-img-top"alt="...">
+ <divclass="card-body">
+ <h5class="card-title">Card title</h5>
+ <pclass="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
+ </div>
+ </div>
+ </div>
+</div>
+
When you need equal height, add .h-100 to the cards. If you want equal heights by default, you can set $card-height: 100% in Sass.
+
+
+
+
+
+
+
+
Card title
+
This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.
+
+
+
+
+
+
+
+
+
Card title
+
This is a short card.
+
+
+
+
+
+
+
+
+
Card title
+
This is a longer card with supporting text below as a natural lead-in to additional content.
+
+
+
+
+
+
+
+
+
Card title
+
This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.
+
+
+
+
+
<divclass="row row-cols-1 row-cols-md-3">
+ <divclass="col mb-4">
+ <divclass="card h-100">
+ <imgsrc="..."class="card-img-top"alt="...">
+ <divclass="card-body">
+ <h5class="card-title">Card title</h5>
+ <pclass="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
+ </div>
+ </div>
+ </div>
+ <divclass="col mb-4">
+ <divclass="card h-100">
+ <imgsrc="..."class="card-img-top"alt="...">
+ <divclass="card-body">
+ <h5class="card-title">Card title</h5>
+ <pclass="card-text">This is a short card.</p>
+ </div>
+ </div>
+ </div>
+ <divclass="col mb-4">
+ <divclass="card h-100">
+ <imgsrc="..."class="card-img-top"alt="...">
+ <divclass="card-body">
+ <h5class="card-title">Card title</h5>
+ <pclass="card-text">This is a longer card with supporting text below as a natural lead-in to additional content.</p>
+ </div>
+ </div>
+ </div>
+ <divclass="col mb-4">
+ <divclass="card h-100">
+ <imgsrc="..."class="card-img-top"alt="...">
+ <divclass="card-body">
+ <h5class="card-title">Card title</h5>
+ <pclass="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
+ </div>
+ </div>
+ </div>
+</div>
+
Card columns
+
Cards can be organized into Masonry-like columns with just CSS by wrapping them in .card-columns. Cards are built with CSS column properties instead of flexbox for easier alignment. Cards are ordered from top to bottom and left to right.
+
Heads up! Your mileage with card columns may vary. To prevent cards breaking across columns, we must set them to display: inline-block as column-break-inside: avoid isn’t a bulletproof solution yet.
+
+
+
+
+
+
+
Card title that wraps to a new line
+
This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.
+
+
+
+
+
A well-known quote, contained in a blockquote element.
+
+
+
+
+
+
+
+
Card title
+
This card has supporting text below as a natural lead-in to additional content.
+
Last updated 3 mins ago
+
+
+
+
+
A well-known quote, contained in a blockquote element.
+
+
+
+
+
+
Card title
+
This card has a regular title and short paragraphy of text below it.
+
Last updated 3 mins ago
+
+
+
+
+
+
+
+
+
A well-known quote, contained in a blockquote element.
+
+
+
+
+
+
Card title
+
This is another card with title and supporting text below. This card has some additional content to make it slightly taller overall.
+
Last updated 3 mins ago
+
+
+
+
<divclass="card-columns">
+ <divclass="card">
+ <imgsrc="..."class="card-img-top"alt="...">
+ <divclass="card-body">
+ <h5class="card-title">Card title that wraps to a new line</h5>
+ <pclass="card-text">This is a longer card with supporting text below as a natural lead-in to additional content. This content is a little bit longer.</p>
+ </div>
+ </div>
+ <divclass="card p-3">
+ <blockquoteclass="blockquote mb-0 card-body">
+ <p>A well-known quote, contained in a blockquote element.</p>
+ <footerclass="blockquote-footer">
+ <smallclass="text-muted">
+ Someone famous in <citetitle="Source Title">Source Title</cite>
+ </small>
+ </footer>
+ </blockquote>
+ </div>
+ <divclass="card">
+ <imgsrc="..."class="card-img-top"alt="...">
+ <divclass="card-body">
+ <h5class="card-title">Card title</h5>
+ <pclass="card-text">This card has supporting text below as a natural lead-in to additional content.</p>
+ <pclass="card-text"><smallclass="text-muted">Last updated 3 mins ago</small></p>
+ </div>
+ </div>
+ <divclass="card bg-primary text-white text-center p-3">
+ <blockquoteclass="blockquote mb-0">
+ <p>A well-known quote, contained in a blockquote element.</p>
+ <footerclass="blockquote-footer text-white">
+ <small>
+ Someone famous in <citetitle="Source Title">Source Title</cite>
+ </small>
+ </footer>
+ </blockquote>
+ </div>
+ <divclass="card text-center">
+ <divclass="card-body">
+ <h5class="card-title">Card title</h5>
+ <pclass="card-text">This card has a regular title and short paragraphy of text below it.</p>
+ <pclass="card-text"><smallclass="text-muted">Last updated 3 mins ago</small></p>
+ </div>
+ </div>
+ <divclass="card">
+ <imgsrc="..."class="card-img"alt="...">
+ </div>
+ <divclass="card p-3 text-right">
+ <blockquoteclass="blockquote mb-0">
+ <p>A well-known quote, contained in a blockquote element.</p>
+ <footerclass="blockquote-footer">
+ <smallclass="text-muted">
+ Someone famous in <citetitle="Source Title">Source Title</cite>
+ </small>
+ </footer>
+ </blockquote>
+ </div>
+ <divclass="card">
+ <divclass="card-body">
+ <h5class="card-title">Card title</h5>
+ <pclass="card-text">This is another card with title and supporting text below. This card has some additional content to make it slightly taller overall.</p>
+ <pclass="card-text"><smallclass="text-muted">Last updated 3 mins ago</small></p>
+ </div>
+ </div>
+</div>
+
Card columns can also be extended and customized with some additional code. Shown below is an extension of the .card-columns class using the same CSS we use—CSS columns— to generate a set of responsive tiers for changing the number of columns.
A slideshow component for cycling through elements—images or slides of text—like a carousel.
+
+
+
How it works
+
The carousel is a slideshow for cycling through a series of content, built with CSS 3D transforms and a bit of JavaScript. It works with a series of images, text, or custom markup. It also includes support for previous/next controls and indicators.
+
In browsers where the Page Visibility API is supported, the carousel will avoid sliding when the webpage is not visible to the user (such as when the browser tab is inactive, the browser window is minimized, etc.).
Please be aware that nested carousels are not supported, and carousels are generally not compliant with accessibility standards.
+
Lastly, if you’re building our JavaScript from source, it requires util.js.
+
Example
+
Carousels don’t automatically normalize slide dimensions. As such, you may need to use additional utilities or custom styles to appropriately size content. While carousels support previous/next controls and indicators, they’re not explicitly required. Add and customize as you see fit.
+
The .active class needs to be added to one of the slides otherwise the carousel will not be visible. Also be sure to set a unique id on the .carousel for optional controls, especially if you’re using multiple carousels on a single page. Control and indicator elements must have a data-target attribute (or href for links) that matches the id of the .carousel element.
+
Slides only
+
Here’s a carousel with slides only. Note the presence of the .d-block and .w-100 on carousel images to prevent browser default image alignment.
Add captions to your slides easily with the .carousel-caption element within any .carousel-item. They can be easily hidden on smaller viewports, as shown below, with optional display utilities. We hide them initially with .d-none and bring them back on medium-sized devices with .d-md-block.
+
+
+
+
+
+
+
+
+
+
+
+
+
First slide label
+
Some representative placeholder content for the first slide.
+
+
+
+
+
+
+
Second slide label
+
Some representative placeholder content for the second slide.
+
+
+
+
+
+
+
Third slide label
+
Some representative placeholder content for the third slide.
Carousels support swiping left/right on touchscreen devices to move between slides. This can be disabled using the data-touch attribute. The example below also does not include the data-ride attribute and has data-interval="false" so it doesn’t autoplay.
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 its current position. Alternatively, use data-slide-to to pass a raw slide index to the carousel data-slide-to="2", which shifts the slide position to a particular index beginning with 0.
+
The data-ride="carousel" attribute is used to mark a carousel as animating starting at page load. If you don’t use data-ride="carousel" to initialize your carousel, you have to initialize it yourself. It cannot be used in combination with (redundant and unnecessary) explicit JavaScript initialization of the same carousel.
+
Via JavaScript
+
Call carousel manually with:
+
$('.carousel').carousel()
+
Options
+
Options can be passed via data attributes or JavaScript. 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.
+
+
+
keyboard
+
boolean
+
true
+
Whether the carousel should react to keyboard events.
+
+
+
pause
+
string | boolean
+
'hover'
+
If set to 'hover', pauses the cycling of the carousel on mouseenter and resumes the cycling of the carousel on mouseleave. If set to false, hovering over the carousel won't pause it.
+
On touch-enabled devices, when set to 'hover', cycling will pause on touchend (once the user finished interacting with the carousel) for two intervals, before automatically resuming. Note that this is in addition to the above mouse behavior.
+
+
+
ride
+
string
+
false
+
Autoplays the carousel after the user manually cycles the first item. If set to 'carousel', autoplays the carousel on load.
+
+
+
wrap
+
boolean
+
true
+
Whether the carousel should cycle continuously or have hard stops.
+
+
+
touch
+
boolean
+
true
+
Whether the carousel should support left/right swipe interactions on touchscreen devices.
+
+
+
+
Methods
+
+
Asynchronous methods and transitions
+
All API methods are asynchronous and start a transition. They return to the caller as soon as the transition is started but before it ends. In addition, a method call on a transitioning component will be ignored.
Initializes the carousel with an optional options object and starts cycling through items.
+
$('.carousel').carousel({
+ interval:2000
+})
+
.carousel('cycle')
+
Cycles through the carousel items from left to right.
+
.carousel('pause')
+
Stops the carousel from cycling through items.
+
.carousel(number)
+
Cycles the carousel to a particular frame (0 based, similar to an array). Returns to the caller before the target item has been shown (i.e. before the slid.bs.carousel event occurs).
+
.carousel('prev')
+
Cycles to the previous item. Returns to the caller before the previous item has been shown (i.e. before the slid.bs.carousel event occurs).
+
.carousel('next')
+
Cycles to the next item. Returns to the caller before the next item has been shown (i.e. before the slid.bs.carousel event occurs).
+
.carousel('dispose')
+
Destroys an element’s carousel.
+
.carousel('nextWhenVisible')
+
Don’t cycle the carousel to next when the page isn’t visible or the carousel or its parent isn’t visible. Returns to the caller before the next item has been shown (i.e. before the slid.bs.carousel event occurs).
+
.carousel('to')
+
Cycles the carousel to a particular frame (0 based, similar to an array). Returns to the caller before the next item has been shown (i.e. before the slid.bs.carousel event occurs).
+
Events
+
Bootstrap’s carousel class exposes two events for hooking into carousel functionality. Both events have the following additional properties:
+
+
direction: The direction in which the carousel is sliding (either "left" or "right").
+
relatedTarget: The DOM element that is being slid into place as the active item.
+
from: The index of the current item
+
to: The index of the next item
+
+
All carousel events are fired at the carousel itself (i.e. at the <div class="carousel">).
+
+
+
+
Event Type
+
Description
+
+
+
+
+
slide.bs.carousel
+
This event fires immediately when the slide instance method is invoked.
+
+
+
slid.bs.carousel
+
This event is fired when the carousel has completed its slide transition.
+
+
+
+
$('#myCarousel').on('slide.bs.carousel',function(){
+ // do something...
+})
+
Change transition duration
+
The transition duration of .carousel-item can be changed with the $carousel-transition Sass variable before compiling or custom styles if you’re using the compiled CSS. If multiple transitions are applied, make sure the transform transition is defined first (eg. transition: transform 2s ease, opacity .5s ease-out).
Toggle the visibility of content across your project with a few classes and our JavaScript plugins.
+
+
+
How it works
+
The collapse JavaScript plugin is used to show and hide content. Buttons or anchors are used as triggers that are mapped to specific elements you toggle. Collapsing an element will animate the height from its current value to 0. Given how CSS handles animations, you cannot use padding on a .collapse element. Instead, use the class as an independent wrapping element.
Click the buttons below to show and hide another element via class changes:
+
+
.collapse hides content
+
.collapsing is applied during transitions
+
.collapse.show shows content
+
+
Generally, we recommend using a button with the data-target attribute. While not recommended from a semantic point of view, you can also use a link with the href attribute (and a role="button"). In both cases, the data-toggle="collapse" is required.
+ Some placeholder content for the collapse component. This panel is hidden by default but revealed when the user activates the relevant trigger.
+
+
+
<p>
+ <aclass="btn btn-primary"data-toggle="collapse"href="#collapseExample"role="button"aria-expanded="false"aria-controls="collapseExample">
+ Link with href
+ </a>
+ <buttonclass="btn btn-primary"type="button"data-toggle="collapse"data-target="#collapseExample"aria-expanded="false"aria-controls="collapseExample">
+ Button with data-target
+ </button>
+</p>
+<divclass="collapse"id="collapseExample">
+ <divclass="card card-body">
+ Some placeholder content for the collapse component. This panel is hidden by default but revealed when the user activates the relevant trigger.
+ </div>
+</div>
+
Multiple targets
+
A <button> or <a> can show and hide multiple elements by referencing them with a JQuery selector in its href or data-target attribute.
+Multiple <button> or <a> can show and hide an element if they each reference it with their href or data-target attribute
+ Some placeholder content for the first collapse component of this multi-collapse example. This panel is hidden by default but revealed when the user activates the relevant trigger.
+
+
+
+
+
+
+ Some placeholder content for the second collapse component of this multi-collapse example. This panel is hidden by default but revealed when the user activates the relevant trigger.
+
+
+
+
+
<p>
+ <aclass="btn btn-primary"data-toggle="collapse"href="#multiCollapseExample1"role="button"aria-expanded="false"aria-controls="multiCollapseExample1">Toggle first element</a>
+ <buttonclass="btn btn-primary"type="button"data-toggle="collapse"data-target="#multiCollapseExample2"aria-expanded="false"aria-controls="multiCollapseExample2">Toggle second element</button>
+ <buttonclass="btn btn-primary"type="button"data-toggle="collapse"data-target=".multi-collapse"aria-expanded="false"aria-controls="multiCollapseExample1 multiCollapseExample2">Toggle both elements</button>
+</p>
+<divclass="row">
+ <divclass="col">
+ <divclass="collapse multi-collapse"id="multiCollapseExample1">
+ <divclass="card card-body">
+ Some placeholder content for the first collapse component of this multi-collapse example. This panel is hidden by default but revealed when the user activates the relevant trigger.
+ </div>
+ </div>
+ </div>
+ <divclass="col">
+ <divclass="collapse multi-collapse"id="multiCollapseExample2">
+ <divclass="card card-body">
+ Some placeholder content for the second collapse component of this multi-collapse example. This panel is hidden by default but revealed when the user activates the relevant trigger.
+ </div>
+ </div>
+ </div>
+</div>
+
Accordion example
+
Using the card component, you can extend the default collapse behavior to create an accordion. To properly achieve the accordion style, be sure to use .accordion as a wrapper.
+
+
+
+
+
+
+
+
+
+
+
+ Some placeholder content for the first accordion panel. This panel is shown by default, thanks to the .show class.
+
+
+
+
+
+
+
+
+
+
+
+ Some placeholder content for the second accordion panel. This panel is hidden by default.
+
+
+
+
+
+
+
+
+
+
+
+ And lastly, the placeholder content for the third and final accordion panel. This panel is hidden by default.
+
+
+
+
+
<divclass="accordion"id="accordionExample">
+ <divclass="card">
+ <divclass="card-header"id="headingOne">
+ <h2class="mb-0">
+ <buttonclass="btn btn-link btn-block text-left"type="button"data-toggle="collapse"data-target="#collapseOne"aria-expanded="true"aria-controls="collapseOne">
+ Collapsible Group Item #1
+ </button>
+ </h2>
+ </div>
+
+ <divid="collapseOne"class="collapse show"aria-labelledby="headingOne"data-parent="#accordionExample">
+ <divclass="card-body">
+ Some placeholder content for the first accordion panel. This panel is shown by default, thanks to the <code>.show</code> class.
+ </div>
+ </div>
+ </div>
+ <divclass="card">
+ <divclass="card-header"id="headingTwo">
+ <h2class="mb-0">
+ <buttonclass="btn btn-link btn-block text-left collapsed"type="button"data-toggle="collapse"data-target="#collapseTwo"aria-expanded="false"aria-controls="collapseTwo">
+ Collapsible Group Item #2
+ </button>
+ </h2>
+ </div>
+ <divid="collapseTwo"class="collapse"aria-labelledby="headingTwo"data-parent="#accordionExample">
+ <divclass="card-body">
+ Some placeholder content for the second accordion panel. This panel is hidden by default.
+ </div>
+ </div>
+ </div>
+ <divclass="card">
+ <divclass="card-header"id="headingThree">
+ <h2class="mb-0">
+ <buttonclass="btn btn-link btn-block text-left collapsed"type="button"data-toggle="collapse"data-target="#collapseThree"aria-expanded="false"aria-controls="collapseThree">
+ Collapsible Group Item #3
+ </button>
+ </h2>
+ </div>
+ <divid="collapseThree"class="collapse"aria-labelledby="headingThree"data-parent="#accordionExample">
+ <divclass="card-body">
+ And lastly, the placeholder content for the third and final accordion panel. This panel is hidden by default.
+ </div>
+ </div>
+ </div>
+</div>
+
Accessibility
+
Be sure to add aria-expanded to the control element. This attribute explicitly conveys the current state of the collapsible element tied to the control to screen readers and similar assistive technologies. If the collapsible element is closed by default, the attribute on the control element should have a value of aria-expanded="false". If you’ve set the collapsible element to be open by default using the show class, set aria-expanded="true" on the control instead. The plugin will automatically toggle this attribute on the control based on whether or not the collapsible element has been opened or closed (via JavaScript, or because the user triggered another control element also tied to the same collapsible element). If the control element’s HTML element is not a button (e.g., an <a> or <div>), the attribute role="button" should be added to the element.
+
If your control element is targeting a single collapsible element – i.e. the data-target attribute is pointing to an id selector – you should add the aria-controls attribute to the control element, containing the id of the collapsible element. Modern screen readers and similar assistive technologies make use of this attribute to provide users with additional shortcuts to navigate directly to the collapsible element itself.
+
Note that Bootstrap’s current implementation does not cover the various keyboard interactions described in the WAI-ARIA Authoring Practices 1.1 accordion pattern - you will need to include these yourself with custom JavaScript.
+
Usage
+
The collapse plugin utilizes a few classes to handle the heavy lifting:
+
+
.collapse hides the content
+
.collapse.show shows the content
+
.collapsing is added when the transition starts, and removed when it finishes
+
+
These classes can be found in _transitions.scss.
+
Via data attributes
+
Just add data-toggle="collapse" and a data-target to the element to automatically assign control of one or more collapsible elements. 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 show.
+
To add accordion-like group management to a collapsible area, add the data attribute data-parent="#selector". Refer to the demo to see this in action.
+
Via JavaScript
+
Enable manually with:
+
$('.collapse').collapse()
+
Options
+
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 | jQuery object | DOM element
+
false
+
If parent is provided, then all collapsible elements under the specified parent will be closed when this collapsible item is shown. (similar to traditional accordion behavior - this is dependent on the card class). The attribute has to be set on the target collapsible area.
+
+
+
toggle
+
boolean
+
true
+
Toggles the collapsible element on invocation
+
+
+
+
Methods
+
+
Asynchronous methods and transitions
+
All API methods are asynchronous and start a transition. They return to the caller as soon as the transition is started but before it ends. In addition, a method call on a transitioning component will be ignored.
Toggles a collapsible element to shown or hidden. Returns to the caller before the collapsible element has actually been shown or hidden (i.e. before the shown.bs.collapse or hidden.bs.collapse event occurs).
+
.collapse('show')
+
Shows a collapsible element. Returns to the caller before the collapsible element has actually been shown (i.e. before the shown.bs.collapse event occurs).
+
.collapse('hide')
+
Hides a collapsible element. Returns to the caller before the collapsible element has actually been hidden (i.e. before the hidden.bs.collapse event occurs).
+
.collapse('dispose')
+
Destroys an element’s collapse.
+
Events
+
Bootstrap’s collapse class exposes a few events for hooking into collapse functionality.
+
+
+
+
Event Type
+
Description
+
+
+
+
+
show.bs.collapse
+
This event fires immediately when the show instance method is called.
+
+
+
shown.bs.collapse
+
This event is fired when a collapse element has been made visible to the user (will wait for CSS transitions to complete).
+
+
+
hide.bs.collapse
+
This event is fired immediately when the hide method has been called.
+
+
+
hidden.bs.collapse
+
This event is fired when a collapse element has been hidden from the user (will wait for CSS transitions to complete).
+
+
+
+
$('#myCollapsible').on('hidden.bs.collapse',function(){
+ // do something...
+})
+
Toggle contextual overlays for displaying lists of links and more with the Bootstrap dropdown plugin.
+
+
+
Overview
+
Dropdowns are toggleable, contextual overlays for displaying lists of links and more. They’re made interactive with the included Bootstrap dropdown JavaScript plugin. They’re toggled by clicking, not by hovering; this is an intentional design decision.
+
Dropdowns are built on a third party library, Popper, which provides dynamic positioning and viewport detection. Be sure to include popper.min.js before Bootstrap’s JavaScript or use bootstrap.bundle.min.js / bootstrap.bundle.js which contains Popper. Popper isn’t used to position dropdowns in navbars though as dynamic positioning isn’t required.
+
If you’re building our JavaScript from source, it requires util.js.
+
Accessibility
+
The WAI ARIA standard defines an actual role="menu" widget, but this is specific to application-like menus which trigger actions or functions. ARIA menus can only contain menu items, checkbox menu items, radio button menu items, radio button groups, and sub-menus.
+
Bootstrap’s dropdowns, on the other hand, are designed to be generic and applicable to a variety of situations and markup structures. For instance, it is possible to create dropdowns that contain additional inputs and form controls, such as search fields or login forms. For this reason, Bootstrap does not expect (nor automatically add) any of the role and aria- attributes required for true ARIA menus. Authors will have to include these more specific attributes themselves.
+
However, Bootstrap does add built-in support for most standard keyboard menu interactions, such as the ability to move through individual .dropdown-item elements using the cursor keys and close the menu with the ESC key.
+
Examples
+
Wrap the dropdown’s toggle (your button or link) and the dropdown menu within .dropdown, or another element that declares position: relative;. Dropdowns can be triggered from <a> or <button> elements to better fit your potential needs.
+
Single button
+
Any single .btn can be turned into a dropdown toggle with some markup changes. Here’s how you can put them to work with either <button> elements:
Similarly, create split button dropdowns with virtually the same markup as single button dropdowns, but with the addition of .dropdown-toggle-split for proper spacing around the dropdown caret.
+
We use this extra class to reduce the horizontal padding on either side of the caret by 25% and remove the margin-left that’s added for regular button dropdowns. Those extra changes keep the caret centered in the split button and provide a more appropriately sized hit area next to the main button.
Historically dropdown menu contents had to be links, but that’s no longer the case with v4. Now you can optionally use <button> elements in your dropdowns instead of just <a>s.
By default, a dropdown menu is automatically positioned 100% from the top and along the left side of its parent. Add .dropdown-menu-right to a .dropdown-menu to right align the dropdown menu.
+
+Heads up! Dropdowns are positioned thanks to Popper (except when they are contained in a navbar).
+
If you want to use responsive alignment, disable dynamic positioning by adding the data-display="static" attribute and use the responsive variation classes.
+
To align right the dropdown menu with the given breakpoint or larger, add .dropdown-menu{-sm|-md|-lg|-xl}-right.
+
+
+
+
+
+
+
+
+
+
<divclass="btn-group">
+ <buttontype="button"class="btn btn-secondary dropdown-toggle"data-toggle="dropdown"data-display="static"aria-haspopup="true"aria-expanded="false">
+ Left-aligned but right aligned when large screen
+ </button>
+ <divclass="dropdown-menu dropdown-menu-lg-right">
+ <buttonclass="dropdown-item"type="button">Action</button>
+ <buttonclass="dropdown-item"type="button">Another action</button>
+ <buttonclass="dropdown-item"type="button">Something else here</button>
+ </div>
+</div>
+
To align left the dropdown menu with the given breakpoint or larger, add .dropdown-menu-right and .dropdown-menu{-sm|-md|-lg|-xl}-left.
+
+
+
+
+
+
+
+
+
+
<divclass="btn-group">
+ <buttontype="button"class="btn btn-secondary dropdown-toggle"data-toggle="dropdown"data-display="static"aria-haspopup="true"aria-expanded="false">
+ Right-aligned but left aligned when large screen
+ </button>
+ <divclass="dropdown-menu dropdown-menu-right dropdown-menu-lg-left">
+ <buttonclass="dropdown-item"type="button">Action</button>
+ <buttonclass="dropdown-item"type="button">Another action</button>
+ <buttonclass="dropdown-item"type="button">Something else here</button>
+ </div>
+</div>
+
Note that you don’t need to add a data-display="static" attribute to dropdown buttons in navbars, since Popper isn’t used in navbars.
+
Menu content
+
Headers
+
Add a header to label sections of actions in any dropdown menu.
Place any freeform text within a dropdown menu with text and use spacing utilities. Note that you’ll likely need additional sizing styles to constrain the menu width.
+
+
+
+ Some example text that's free-flowing within the dropdown menu.
+
+
+ And this is more example text.
+
+
+
<divclass="dropdown-menu p-4 text-muted"style="max-width: 200px;">
+ <p>
+ Some example text that's free-flowing within the dropdown menu.
+ </p>
+ <pclass="mb-0">
+ And this is more example text.
+ </p>
+</div>
+
Forms
+
Put a form within a dropdown menu, or make it into a dropdown menu, and use margin or padding utilities to give it the negative space you require.
Via data attributes or JavaScript, the dropdown plugin toggles hidden content (dropdown menus) by toggling the .show class on the parent .dropdown-menu. The data-toggle="dropdown" attribute is relied on for closing dropdown menus at an application level, so it’s a good idea to always use it.
+
+On touch-enabled devices, opening a dropdown adds empty ($.noop) mouseover handlers to the immediate children of the <body> element. This admittedly ugly hack is necessary to work around a quirk in iOS' event delegation, which would otherwise prevent a tap anywhere outside of the dropdown from triggering the code that closes the dropdown. Once the dropdown is closed, these additional empty mouseover handlers are removed.
+
+
+
Via data attributes
+
Add data-toggle="dropdown" to a link or button to toggle a dropdown.
Regardless of whether you call your dropdown via JavaScript or instead use the data-api, data-toggle="dropdown" is always required to be present on the dropdown’s trigger element.
+
+
+
Options
+
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 | string | function
+
0
+
+
Offset of the dropdown relative to its target.
+
When a function is used to determine the offset, it is called with an object containing the offset data as its first argument. The function must return an object with the same structure. The triggering element DOM node is passed as the second argument.
+
For more information refer to Popper's offset docs.
+
+
+
+
flip
+
boolean
+
true
+
Allow Dropdown to flip in case of an overlapping on the reference element. For more information refer to Popper's flip docs.
+
+
+
boundary
+
string | element
+
'scrollParent'
+
Overflow constraint boundary of the dropdown menu. Accepts the values of 'viewport', 'window', 'scrollParent', or an HTMLElement reference (JavaScript only). For more information refer to Popper's preventOverflow docs.
+
+
+
reference
+
string | element
+
'toggle'
+
Reference element of the dropdown menu. Accepts the values of 'toggle', 'parent', or an HTMLElement reference. For more information refer to Popper's referenceObject docs.
+
+
+
display
+
string
+
'dynamic'
+
By default, we use Popper for dynamic positioning. Disable this with static.
Note when boundary is set to any value other than 'scrollParent', the style position: static is applied to the .dropdown container.
+
Methods
+
+
+
+
Method
+
Description
+
+
+
+
+
$().dropdown('toggle')
+
Toggles the dropdown menu of a given navbar or tabbed navigation.
+
+
+
$().dropdown('show')
+
Shows the dropdown menu of a given navbar or tabbed navigation.
+
+
+
$().dropdown('hide')
+
Hides the dropdown menu of a given navbar or tabbed navigation.
+
+
+
$().dropdown('update')
+
Updates the position of an element’s dropdown.
+
+
+
$().dropdown('dispose')
+
Destroys an element’s dropdown.
+
+
+
+
Events
+
All dropdown events are fired at the .dropdown-menu’s parent element and have a relatedTarget property, whose value is the toggling anchor element.
+hide.bs.dropdown and hidden.bs.dropdown events have a clickEvent property (only when the original event type is click) that contains an Event Object for the click event.
+
+
+
+
Event
+
Description
+
+
+
+
+
show.bs.dropdown
+
This event fires immediately when the show instance method is called.
+
+
+
shown.bs.dropdown
+
This event is fired when the dropdown has been made visible to the user (will wait for CSS transitions, to complete).
+
+
+
hide.bs.dropdown
+
This event is fired immediately when the hide instance method has been called.
+
+
+
hidden.bs.dropdown
+
This event is fired when the dropdown has finished being hidden from the user (will wait for CSS transitions, to complete).
+
+
+
+
$('#myDropdown').on('show.bs.dropdown',function(){
+ // do something...
+})
+
Examples and usage guidelines for form control styles, layout options, and custom components for creating a wide variety of forms.
+
+
+
Overview
+
Bootstrap’s form controls expand on our Rebooted form styles with classes. Use these classes to opt into their customized displays for a more consistent rendering across browsers and devices.
+
Be sure to use an appropriate type attribute on all inputs (e.g., email for email address or number for numerical information) to take advantage of newer input controls like email verification, number selection, and more.
+
Here’s a quick example to demonstrate Bootstrap’s form styles. Keep reading for documentation on required classes, form layout, and more.
Textual form controls—like <input>s, <select>s, and <textarea>s—are styled with the .form-control class. Included are styles for general appearance, focus state, sizing, and more.
+
Be sure to explore our custom forms to further style <select>s.
Add the readonly boolean attribute on an input to prevent modification of the input’s value. Read-only inputs appear lighter (just like disabled inputs), but retain the standard cursor.
If you want to have <input readonly> elements in your form styled as plain text, use the .form-control-plaintext class to remove the default form field styling and preserve the correct margin and padding.
Default checkboxes and radios are improved upon with the help of .form-check, a single class for both input types that improves the layout and behavior of their HTML elements. Checkboxes are for selecting one or several options in a list, while radios are for selecting one option from many.
+
Disabled checkboxes and radios are supported. The disabled attribute will apply a lighter color to help indicate the input’s state.
+
Checkboxes and radio buttons support HTML-based form validation and provide concise, accessible labels. As such, our <input>s and <label>s are sibling elements as opposed to an <input> within a <label>. This is slightly more verbose as you must specify id and for attributes to relate the <input> and <label>.
+
Default (stacked)
+
By default, any number of checkboxes and radios that are immediate sibling will be vertically stacked and appropriately spaced with .form-check.
Add .position-static to inputs within .form-check that don’t have any label text. Remember to still provide some form of accessible name for assistive technologies (for instance, using aria-label).
Since Bootstrap applies display: block and width: 100% to almost all our form controls, forms will by default stack vertically. Additional classes can be used to vary this layout on a per-form basis.
+
Form groups
+
The .form-group class is the easiest way to add some structure to forms. It provides a flexible class that encourages proper grouping of labels, controls, optional help text, and form validation messaging. By default it only applies margin-bottom, but it picks up additional styles in .form-inline as needed. Use it with <fieldset>s, <div>s, or nearly any other element.
More complex forms can be built using our grid classes. Use these for form layouts that require multiple columns, varied widths, and additional alignment options.
You may also swap .row for .form-row, a variation of our standard grid row that overrides the default column gutters for tighter and more compact layouts.
Create horizontal forms with the grid by adding the .row class to form groups and using the .col-*-* classes to specify the width of your labels and controls. Be sure to add .col-form-label to your <label>s as well so they’re vertically centered with their associated form controls.
+
At times, you maybe need to use margin or padding utilities to create that perfect alignment you need. For example, we’ve removed the padding-top on our stacked radio inputs label to better align the text baseline.
Be sure to use .col-form-label-sm or .col-form-label-lg to your <label>s or <legend>s to correctly follow the size of .form-control-lg and .form-control-sm.
As shown in the previous examples, our grid system allows you to place any number of .cols within a .row or .form-row. They’ll split the available width equally between them. You may also pick a subset of your columns to take up more or less space, while the remaining .cols equally split the rest, with specific column classes like .col-7.
The example below uses a flexbox utility to vertically center the contents and changes .col to .col-auto so that your columns only take up as much space as needed. Put another way, the column sizes itself based on the contents.
Use the .form-inline class to display a series of labels, form controls, and buttons on a single horizontal row. Form controls within inline forms vary slightly from their default states.
+
+
Controls are display: flex, collapsing any HTML white space and allowing you to provide alignment control with spacing and flexbox utilities.
+
Controls and input groups receive width: auto to override the Bootstrap default width: 100%.
+
Controls only appear inline in viewports that are at least 576px wide to account for narrow viewports on mobile devices.
+
+
You may need to manually address the width and alignment of individual form controls with spacing utilities (as shown below). Lastly, be sure to always include a <label> with each form control, even if you need to hide it from non-screenreader visitors with .sr-only.
Assistive technologies such as screen readers will have trouble with your forms if you don’t include a label for every input. For these inline forms, you can hide the labels using the .sr-only class. There are further alternative methods of providing a label for assistive technologies, such as the aria-label, aria-labelledby or title attribute. If none of these are present, assistive technologies may resort to using the placeholder attribute, if present, but note that use of placeholder as a replacement for other labelling methods is not advised.
+
+
+
Help text
+
Block-level help text in forms can be created using .form-text (previously known as .help-block in v3). Inline help text can be flexibly implemented using any inline HTML element and utility classes like .text-muted.
+
+
Associating help text with form controls
+
Help text should be explicitly associated with the form control it relates to using the aria-describedby attribute. This will ensure that assistive technologies—such as screen readers—will announce this help text when the user focuses or enters the control.
+
+
+
Help text below inputs can be styled with .form-text. This class includes display: block and adds some top margin for easy spacing from the inputs above.
+
+
+
+
+ Your password must be 8-20 characters long, contain letters and numbers, and must not contain spaces, special characters, or emoji.
+
+
<labelfor="inputPassword5">Password</label>
+<inputtype="password"id="inputPassword5"class="form-control"aria-describedby="passwordHelpBlock">
+<smallid="passwordHelpBlock"class="form-text text-muted">
+ Your password must be 8-20 characters long, contain letters and numbers, and must not contain spaces, special characters, or emoji.
+</small>
+
Inline text can use any typical inline HTML element (be it a <small>, <span>, or something else) with nothing more than a utility class.
Browsers treat all native form controls (<input>, <select>, and <button> elements) inside a <fieldset disabled> as disabled, preventing both keyboard and mouse interactions on them.
+
However, if your form also includes custom button-like elements such as <a ... class="btn btn-*">, these will only be given a style of pointer-events: none. As noted in the section about disabled state for buttons (and specifically in the sub-section for anchor elements), this CSS property is not yet standardized and isn’t fully supported in Internet Explorer 10. The anchor-based controls will also still be focusable and operable using the keyboard. You must manually modify these controls by adding tabindex="-1" to prevent them from receiving focus and aria-disabled="disabled" to signal their state to assistive technologies.
+
+
+
+
+
Cross-browser compatibility
+
While Bootstrap will apply these styles in all browsers, Internet Explorer 11 and below don’t fully support the disabled attribute on a <fieldset>. Use custom JavaScript to disable the fieldset in these browsers.
+
+
+
Validation
+
Provide valuable, actionable feedback to your users with HTML5 form validation–available in all our supported browsers. Choose from the browser default validation feedback, or implement custom messages with our built-in classes and starter JavaScript.
+
+We are aware that currently the client-side custom validation styles and tooltips are not accessible, since they are not exposed to assistive technologies. While we work on a solution, we’d recommend either using the server-side option or the default browser validation method.
+
+
+
How it works
+
Here’s how form validation works with Bootstrap:
+
+
HTML form validation is applied via CSS’s two pseudo-classes, :invalid and :valid. It applies to <input>, <select>, and <textarea> elements.
+
Bootstrap scopes the :invalid and :valid styles to parent .was-validated class, usually applied to the <form>. Otherwise, any required field without a value shows up as invalid on page load. This way, you may choose when to activate them (typically after form submission is attempted).
+
To reset the appearance of the form (for instance, in the case of dynamic form submissions using AJAX), remove the .was-validated class from the <form> again after submission.
+
As a fallback, .is-invalid and .is-valid classes may be used instead of the pseudo-classes for server side validation. They do not require a .was-validated parent class.
+
Due to constraints in how CSS works, we cannot (at present) apply styles to a <label> that comes before a form control in the DOM without the help of custom JavaScript.
+
All modern browsers support the constraint validation API, a series of JavaScript methods for validating form controls.
+
Feedback messages may utilize the browser defaults (different for each browser, and unstylable via CSS) or our custom feedback styles with additional HTML and CSS.
+
You may provide custom validity messages with setCustomValidity in JavaScript.
+
+
With that in mind, consider the following demos for our custom form validation styles, optional server side classes, and browser defaults.
+
Custom styles
+
For custom Bootstrap form validation messages, you’ll need to add the novalidate boolean attribute to your <form>. This disables the browser default feedback tooltips, but still provides access to the form validation APIs in JavaScript. Try to submit the form below; our JavaScript will intercept the submit button and relay feedback to you. When attempting to submit, you’ll see the :invalid and :valid styles applied to your form controls.
+
Custom feedback styles apply custom colors, borders, focus styles, and background icons to better communicate feedback. Background icons for <select>s are only available with .custom-select, and not .form-control.
+
+
+
+
+
<formclass="needs-validation"novalidate>
+ <divclass="form-row">
+ <divclass="col-md-6 mb-3">
+ <labelfor="validationCustom01">First name</label>
+ <inputtype="text"class="form-control"id="validationCustom01"value="Mark"required>
+ <divclass="valid-feedback">
+ Looks good!
+ </div>
+ </div>
+ <divclass="col-md-6 mb-3">
+ <labelfor="validationCustom02">Last name</label>
+ <inputtype="text"class="form-control"id="validationCustom02"value="Otto"required>
+ <divclass="valid-feedback">
+ Looks good!
+ </div>
+ </div>
+ </div>
+ <divclass="form-row">
+ <divclass="col-md-6 mb-3">
+ <labelfor="validationCustom03">City</label>
+ <inputtype="text"class="form-control"id="validationCustom03"required>
+ <divclass="invalid-feedback">
+ Please provide a valid city.
+ </div>
+ </div>
+ <divclass="col-md-3 mb-3">
+ <labelfor="validationCustom04">State</label>
+ <selectclass="custom-select"id="validationCustom04"required>
+ <optionselecteddisabledvalue="">Choose...</option>
+ <option>...</option>
+ </select>
+ <divclass="invalid-feedback">
+ Please select a valid state.
+ </div>
+ </div>
+ <divclass="col-md-3 mb-3">
+ <labelfor="validationCustom05">Zip</label>
+ <inputtype="text"class="form-control"id="validationCustom05"required>
+ <divclass="invalid-feedback">
+ Please provide a valid zip.
+ </div>
+ </div>
+ </div>
+ <divclass="form-group">
+ <divclass="form-check">
+ <inputclass="form-check-input"type="checkbox"value=""id="invalidCheck"required>
+ <labelclass="form-check-label"for="invalidCheck">
+ Agree to terms and conditions
+ </label>
+ <divclass="invalid-feedback">
+ You must agree before submitting.
+ </div>
+ </div>
+ </div>
+ <buttonclass="btn btn-primary"type="submit">Submit form</button>
+</form>
+
+<script>
+// Example starter JavaScript for disabling form submissions if there are invalid fields
+(function(){
+ 'use strict';
+ window.addEventListener('load',function(){
+ // Fetch all the forms we want to apply custom Bootstrap validation styles to
+varforms=document.getElementsByClassName('needs-validation');
+ // Loop over them and prevent submission
+varvalidation=Array.prototype.filter.call(forms,function(form){
+ form.addEventListener('submit',function(event){
+ if(form.checkValidity()===false){
+ event.preventDefault();
+ event.stopPropagation();
+ }
+ form.classList.add('was-validated');
+ },false);
+ });
+ },false);
+})();
+</script>
+
Browser defaults
+
Not interested in custom validation feedback messages or writing JavaScript to change form behaviors? All good, you can use the browser defaults. Try submitting the form below. Depending on your browser and OS, you’ll see a slightly different style of feedback.
+
While these feedback styles cannot be styled with CSS, you can still customize the feedback text through JavaScript.
We recommend using client-side validation, but in case you require server-side validation, you can indicate invalid and valid form fields with .is-invalid and .is-valid. Note that .invalid-feedback is also supported with these classes.
+
For invalid fields, ensure that the invalid feedback/error message is associated with the relevant form field using aria-describedby. This attribute allows more than one id to be referenced, in case the field already points to additional form text.
If your form layout allows it, you can swap the .{valid|invalid}-feedback classes for .{valid|invalid}-tooltip classes to display validation feedback in a styled tooltip. Be sure to have a parent with position: relative on it for tooltip positioning. In the example below, our column classes have this already, but your project may require an alternative setup.
Validation states can be customized via Sass with the $form-validation-states map. Located in our _variables.scss file, this Sass map is looped over to generate the default valid/invalid validation states. Included is a nested map for customizing each state’s color and icon. While no other states are supported by browsers, those using custom styles can easily add more complex form feedback.
+
Please note that we do not recommend customizing these values without also modifying the form-validation-state mixin.
+
// Sass map from `_variables.scss`
+// Override this and recompile your Sass to generate different states
+$form-validation-states:map-merge(
+ (
+ "valid":(
+ "color":$form-feedback-valid-color,
+ "icon":$form-feedback-icon-valid
+ ),
+ "invalid":(
+ "color":$form-feedback-invalid-color,
+ "icon":$form-feedback-icon-invalid
+ )
+ ),
+ $form-validation-states
+);
+
+// Loop from `_forms.scss`
+// Any modifications to the above Sass map will be reflected in your compiled
+// CSS via this loop.
+@each$state,$datain$form-validation-states{
+ @include form-validation-state($state,map-get($data,color),map-get($data,icon));
+}
+
Input group validation
+
To detect what elements need rounded corners inside an input group with validation, an input group requires an additional .has-validation class.
For even more customization and cross browser consistency, use our completely custom form elements to replace the browser defaults. They’re built on top of semantic and accessible markup, so they’re solid replacements for any default form control.
+
Checkboxes and radios
+
Each checkbox and radio <input> and <label> pairing is wrapped in a <div> to create our custom control. Structurally, this is the same approach as our default .form-check.
+
We use the sibling selector (~) for all our <input> states—like :checked—to properly style our custom form indicator. When combined with the .custom-control-label class, we can also style the text for each item based on the <input>’s state.
+
We hide the default <input> with opacity and use the .custom-control-label to build a new custom form indicator in its place with ::before and ::after. Unfortunately we can’t build a custom one from just the <input> because CSS’s content doesn’t work on that element.
+
In the checked states, we use base64 embedded SVG icons from Open Iconic. This provides us the best control for styling and positioning across browsers and devices.
+
Checkboxes
+
+
+
+
+
+
<divclass="custom-control custom-checkbox">
+ <inputtype="checkbox"class="custom-control-input"id="customCheck1">
+ <labelclass="custom-control-label"for="customCheck1">Check this custom checkbox</label>
+</div>
+
Custom checkboxes can also utilize the :indeterminate pseudo class when manually set via JavaScript (there is no available HTML attribute for specifying it).
+
+
+
+
+
+
+
If you’re using jQuery, something like this should suffice:
+
$('.your-checkbox').prop('indeterminate',true)
+
Radios
+
+
+
+
+
+
+
+
+
+
<divclass="custom-control custom-radio">
+ <inputtype="radio"id="customRadio1"name="customRadio"class="custom-control-input">
+ <labelclass="custom-control-label"for="customRadio1">Toggle this custom radio</label>
+</div>
+<divclass="custom-control custom-radio">
+ <inputtype="radio"id="customRadio2"name="customRadio"class="custom-control-input">
+ <labelclass="custom-control-label"for="customRadio2">Or toggle this other custom radio</label>
+</div>
+
Inline
+
+
+
+
+
+
+
+
+
+
<divclass="custom-control custom-radio custom-control-inline">
+ <inputtype="radio"id="customRadioInline1"name="customRadioInline"class="custom-control-input">
+ <labelclass="custom-control-label"for="customRadioInline1">Toggle this custom radio</label>
+</div>
+<divclass="custom-control custom-radio custom-control-inline">
+ <inputtype="radio"id="customRadioInline2"name="customRadioInline"class="custom-control-input">
+ <labelclass="custom-control-label"for="customRadioInline2">Or toggle this other custom radio</label>
+</div>
+
Disabled
+
Custom checkboxes and radios can also be disabled. Add the disabled boolean attribute to the <input> and the custom indicator and label description will be automatically styled.
A switch has the markup of a custom checkbox but uses the .custom-switch class to render a toggle switch. Switches also support the disabled attribute.
Custom <select> menus need only a custom class, .custom-select to trigger the custom styles. Custom styles are limited to the <select>’s initial appearance and cannot modify the <option>s due to browser limitations.
Create custom <input type="range"> controls with .custom-range. The track (the background) and thumb (the value) are both styled to appear the same across browsers. As only IE and Firefox support “filling” their track from the left or right of the thumb as a means to visually indicate progress, we do not currently support it.
By default, range inputs “snap” to integer values. To change this, you can specify a step value. In the example below, we double the number of steps by using step="0.5".
+The recommended plugin to animate custom file input: bs-custom-file-input, that’s what we are using currently here in our docs.
+
+
+
The file input is the most gnarly of the bunch and requires additional JavaScript if you’d like to hook them up with functional Choose file… and selected file name text.
We hide the default file <input> via opacity and instead style the <label>. The button is generated and positioned with ::after. Lastly, we declare a width and height on the <input> for proper spacing for surrounding content.
+
Translating or customizing the strings with SCSS
+
The :lang() pseudo-class is used to allow for translation of the “Browse” text into other languages. Override or add entries to the $custom-file-text Sass variable with the relevant language tag and localized strings. The English strings can be customized the same way. For example, here’s how one might add a Spanish translation (Spanish’s language code is es):
You’ll need to set the language of your document (or subtree thereof) correctly in order for the correct text to be shown. This can be done using the lang attribute on the <html> element or the Content-Language HTTP header, among other methods.
+
Translating or customizing the strings with HTML
+
Bootstrap also provides a way to translate the “Browse” text in HTML with the data-browse attribute which can be added to the custom input label (example in Dutch):
+
+
+
+
+
+
<divclass="custom-file">
+ <inputtype="file"class="custom-file-input"id="customFileLangHTML">
+ <labelclass="custom-file-label"for="customFileLangHTML"data-browse="Bestand kiezen">Voeg je document toe</label>
+</div>
Easily extend form controls by adding text, buttons, or button groups on either side of textual inputs, custom selects, and custom file inputs.
+
+
+
Basic example
+
Place one add-on or button on either side of an input. You may also place one on both sides of an input. Remember to place <label>s outside the input group.
Input groups wrap by default via flex-wrap: wrap in order to accommodate custom form field validation within an input group. You may disable this with .flex-nowrap.
Add the relative form sizing classes to the .input-group itself and contents within will automatically resize—no need for repeating the form control size classes on each element.
+
Sizing on the individual input group elements isn’t supported.
Ensure that all form controls have an appropriate accessible name so that their purpose can be conveyed to users of assistive technologies. The simplest way to achieve this is to use a <label> element, or—in the case of buttons—to include sufficiently descriptive text as part of the <button>...</button> content.
+
For situations where it’s not possible to include a visible <label> or appropriate text content, there are alternative ways of still providing an accessible name, such as:
+
+
<label> elements hidden using the .sr-only class
+
Pointing to an existing element that can act as a label using aria-labelledby
+
Providing a title attribute
+
Explicitly setting the accessible name on an element using aria-label
+
+
If none of these are present, assistive technologies may resort to using the placeholder attribute as a fallback for the accessible name on <input> and <textarea> elements. The examples in this section provide a few suggested, case-specific approaches.
+
While using visually hidden content (.sr-only, aria-label, and even placeholder content, which disappears once a form field has content) will benefit assistive technology users, a lack of visible label text may still be problematic for certain users. Some form of visible label is generally the best approach, both for accessibility and usability.
<divclass="jumbotron">
+ <h1class="display-4">Hello, world!</h1>
+ <pclass="lead">This is a simple hero unit, a simple jumbotron-style component for calling extra attention to featured content or information.</p>
+ <hrclass="my-4">
+ <p>It uses utility classes for typography and spacing to space content out within the larger container.</p>
+ <aclass="btn btn-primary btn-lg"href="#"role="button">Learn more</a>
+</div>
+
To make the jumbotron full width, and without rounded corners, add the .jumbotron-fluid modifier class and add a .container or .container-fluid within.
+
+
+
+
Fluid jumbotron
+
This is a modified jumbotron that occupies the entire horizontal space of its parent.
+
+
+
<divclass="jumbotron jumbotron-fluid">
+ <divclass="container">
+ <h1class="display-4">Fluid jumbotron</h1>
+ <pclass="lead">This is a modified jumbotron that occupies the entire horizontal space of its parent.</p>
+ </div>
+</div>
List groups are a flexible and powerful component for displaying a series of content. Modify and extend them to support just about any content within.
+
+
+
Basic example
+
The most basic list group is an unordered list with list items and the proper classes. Build upon it with the options that follow, or with your own CSS as needed.
+
+
+
An item
+
A second item
+
A third item
+
A fourth item
+
And a fifth one
+
+
<ulclass="list-group">
+ <liclass="list-group-item">An item</li>
+ <liclass="list-group-item">A second item</li>
+ <liclass="list-group-item">A third item</li>
+ <liclass="list-group-item">A fourth item</li>
+ <liclass="list-group-item">And a fifth one</li>
+</ul>
+
Active items
+
Add .active to a .list-group-item to indicate the current active selection.
+
+
+
An active item
+
A second item
+
A third item
+
A fourth item
+
And a fifth one
+
+
<ulclass="list-group">
+ <liclass="list-group-item active"aria-current="true">An active item</li>
+ <liclass="list-group-item">A second item</li>
+ <liclass="list-group-item">A third item</li>
+ <liclass="list-group-item">A fourth item</li>
+ <liclass="list-group-item">And a fifth one</li>
+</ul>
+
Disabled items
+
Add .disabled to a .list-group-item to make it appear disabled. Note that some elements with .disabled will also require custom JavaScript to fully disable their click events (e.g., links).
+
+
+
A disabled item
+
A second item
+
A third item
+
A fourth item
+
And a fifth one
+
+
<ulclass="list-group">
+ <liclass="list-group-item disabled"aria-disabled="true">A disabled item</li>
+ <liclass="list-group-item">A second item</li>
+ <liclass="list-group-item">A third item</li>
+ <liclass="list-group-item">A fourth item</li>
+ <liclass="list-group-item">And a fifth one</li>
+</ul>
+
Links and buttons
+
Use <a>s or <button>s to create actionable list group items with hover, disabled, and active states by adding .list-group-item-action. We separate these pseudo-classes to ensure list groups made of non-interactive elements (like <li>s or <div>s) don’t provide a click or tap affordance.
+
Be sure to not use the standard .btn classes here.
<divclass="list-group">
+ <ahref="#"class="list-group-item list-group-item-action active"aria-current="true">
+ The current link item
+ </a>
+ <ahref="#"class="list-group-item list-group-item-action">A second link item</a>
+ <ahref="#"class="list-group-item list-group-item-action">A third link item</a>
+ <ahref="#"class="list-group-item list-group-item-action">A fourth link item</a>
+ <ahref="#"class="list-group-item list-group-item-action disabled"tabindex="-1"aria-disabled="true">A disabled link item</a>
+</div>
+
With <button>s, you can also make use of the disabled attribute instead of the .disabled class. Sadly, <a>s don’t support the disabled attribute.
+
+
+
+
+
+
+
+
+
<divclass="list-group">
+ <buttontype="button"class="list-group-item list-group-item-action active"aria-current="true">
+ The current button
+ </button>
+ <buttontype="button"class="list-group-item list-group-item-action">A second item</button>
+ <buttontype="button"class="list-group-item list-group-item-action">A third button item</button>
+ <buttontype="button"class="list-group-item list-group-item-action">A fourth button item</button>
+ <buttontype="button"class="list-group-item list-group-item-action"disabled>A disabled button item</button>
+</div>
+
Flush
+
Add .list-group-flush to remove some borders and rounded corners to render list group items edge-to-edge in a parent container (e.g., cards).
+
+
+
An item
+
A second item
+
A third item
+
A fourth item
+
And a fifth one
+
+
<ulclass="list-group list-group-flush">
+ <liclass="list-group-item">An item</li>
+ <liclass="list-group-item">A second item</li>
+ <liclass="list-group-item">A third item</li>
+ <liclass="list-group-item">A fourth item</li>
+ <liclass="list-group-item">And a fifth one</li>
+</ul>
+
Horizontal
+
Add .list-group-horizontal to change the layout of list group items from vertical to horizontal across all breakpoints. Alternatively, choose a responsive variant .list-group-horizontal-{sm|md|lg|xl} to make a list group horizontal starting at that breakpoint’s min-width. Currently horizontal list groups cannot be combined with flush list groups.
+
ProTip: Want equal-width list group items when horizontal? Add .flex-fill to each list group item.
+
+
+
+
An item
+
A second item
+
A third item
+
+
+
An item
+
A second item
+
A third item
+
+
+
An item
+
A second item
+
A third item
+
+
+
An item
+
A second item
+
A third item
+
+
+
An item
+
A second item
+
A third item
+
+
<ulclass="list-group list-group-horizontal">
+ <liclass="list-group-item">An item</li>
+ <liclass="list-group-item">A second item</li>
+ <liclass="list-group-item">A third item</li>
+</ul>
+<ulclass="list-group list-group-horizontal-sm">
+ <liclass="list-group-item">An item</li>
+ <liclass="list-group-item">A second item</li>
+ <liclass="list-group-item">A third item</li>
+</ul>
+<ulclass="list-group list-group-horizontal-md">
+ <liclass="list-group-item">An item</li>
+ <liclass="list-group-item">A second item</li>
+ <liclass="list-group-item">A third item</li>
+</ul>
+<ulclass="list-group list-group-horizontal-lg">
+ <liclass="list-group-item">An item</li>
+ <liclass="list-group-item">A second item</li>
+ <liclass="list-group-item">A third item</li>
+</ul>
+<ulclass="list-group list-group-horizontal-xl">
+ <liclass="list-group-item">An item</li>
+ <liclass="list-group-item">A second item</li>
+ <liclass="list-group-item">A third item</li>
+</ul>
+
Contextual classes
+
Use contextual classes to style list items with a stateful background and color.
+
+
+
A simple default list group item
+
+
A simple primary list group item
+
A simple secondary list group item
+
A simple success list group item
+
A simple danger list group item
+
A simple warning list group item
+
A simple info list group item
+
A simple light list group item
+
A simple dark list group item
+
+
<ulclass="list-group">
+ <liclass="list-group-item">A simple default list group item</li>
+
+ <liclass="list-group-item list-group-item-primary">A simple primary list group item</li>
+ <liclass="list-group-item list-group-item-secondary">A simple secondary list group item</li>
+ <liclass="list-group-item list-group-item-success">A simple success list group item</li>
+ <liclass="list-group-item list-group-item-danger">A simple danger list group item</li>
+ <liclass="list-group-item list-group-item-warning">A simple warning list group item</li>
+ <liclass="list-group-item list-group-item-info">A simple info list group item</li>
+ <liclass="list-group-item list-group-item-light">A simple light list group item</li>
+ <liclass="list-group-item list-group-item-dark">A simple dark list group item</li>
+</ul>
+
Contextual classes also work with .list-group-item-action. Note the addition of the hover styles here not present in the previous example. Also supported is the .active state; apply it to indicate an active selection on a contextual list group item.
<divclass="list-group">
+ <ahref="#"class="list-group-item list-group-item-action">A simple default list group item</a>
+
+ <ahref="#"class="list-group-item list-group-item-action list-group-item-primary">A simple primary list group item</a>
+ <ahref="#"class="list-group-item list-group-item-action list-group-item-secondary">A simple secondary list group item</a>
+ <ahref="#"class="list-group-item list-group-item-action list-group-item-success">A simple success list group item</a>
+ <ahref="#"class="list-group-item list-group-item-action list-group-item-danger">A simple danger list group item</a>
+ <ahref="#"class="list-group-item list-group-item-action list-group-item-warning">A simple warning list group item</a>
+ <ahref="#"class="list-group-item list-group-item-action list-group-item-info">A simple info list group item</a>
+ <ahref="#"class="list-group-item list-group-item-action list-group-item-light">A simple light list group item</a>
+ <ahref="#"class="list-group-item list-group-item-action list-group-item-dark">A simple dark list group item</a>
+</div>
+
+
Conveying meaning to assistive technologies
+
Using color to add meaning only provides a visual indication, which will not be conveyed to users of assistive technologies – such as screen readers. Ensure that information denoted by the color is either obvious from the content itself (e.g. the visible text), or is included through alternative means, such as additional text hidden with the .sr-only class.
+
+
+
With badges
+
Add badges to any list group item to show unread counts, activity, and more with the help of some utilities.
+
+
+
+ A list item
+ 14
+
+
+ A second list item
+ 2
+
+
+ A third list item
+ 1
+
+
+
<ulclass="list-group">
+ <liclass="list-group-item d-flex justify-content-between align-items-center">
+ A list item
+ <spanclass="badge badge-primary badge-pill">14</span>
+ </li>
+ <liclass="list-group-item d-flex justify-content-between align-items-center">
+ A second list item
+ <spanclass="badge badge-primary badge-pill">2</span>
+ </li>
+ <liclass="list-group-item d-flex justify-content-between align-items-center">
+ A third list item
+ <spanclass="badge badge-primary badge-pill">1</span>
+ </li>
+</ul>
+
Custom content
+
Add nearly any HTML within, even for linked list groups like the one below, with the help of flexbox utilities.
<divclass="list-group">
+ <ahref="#"class="list-group-item list-group-item-action active">
+ <divclass="d-flex w-100 justify-content-between">
+ <h5class="mb-1">List group item heading</h5>
+ <small>3 days ago</small>
+ </div>
+ <pclass="mb-1">Some placeholder content in a paragraph.</p>
+ <small>And some small print.</small>
+ </a>
+ <ahref="#"class="list-group-item list-group-item-action">
+ <divclass="d-flex w-100 justify-content-between">
+ <h5class="mb-1">List group item heading</h5>
+ <smallclass="text-muted">3 days ago</small>
+ </div>
+ <pclass="mb-1">Some placeholder content in a paragraph.</p>
+ <smallclass="text-muted">And some muted small print.</small>
+ </a>
+ <ahref="#"class="list-group-item list-group-item-action">
+ <divclass="d-flex w-100 justify-content-between">
+ <h5class="mb-1">List group item heading</h5>
+ <smallclass="text-muted">3 days ago</small>
+ </div>
+ <pclass="mb-1">Some placeholder content in a paragraph.</p>
+ <smallclass="text-muted">And some muted small print.</small>
+ </a>
+</div>
+
JavaScript behavior
+
Use the tab JavaScript plugin—include it individually or through the compiled bootstrap.js file—to extend our list group to create tabbable panes of local content.
Some placeholder content in a paragraph relating to "Home". And some more content, used here just to pad out and fill this tab panel. In production, you would obviously have more real content here. And not just text. It could be anything, really. Text, images, forms.
+
+
+
Some placeholder content in a paragraph relating to "Profile". And some more content, used here just to pad out and fill this tab panel. In production, you would obviously have more real content here. And not just text. It could be anything, really. Text, images, forms.
+
+
+
Some placeholder content in a paragraph relating to "Messages". And some more content, used here just to pad out and fill this tab panel. In production, you would obviously have more real content here. And not just text. It could be anything, really. Text, images, forms.
+
+
+
Some placeholder content in a paragraph relating to "Settings". And some more content, used here just to pad out and fill this tab panel. In production, you would obviously have more real content here. And not just text. It could be anything, really. Text, images, forms.
You can activate a list group navigation without writing any JavaScript by simply specifying data-toggle="list" or on an element. Use these data attributes on .list-group-item.
You can activate individual list item in several ways:
+
$('#myList a[href="#profile"]').tab('show')// Select tab by name
+$('#myList a:first-child').tab('show')// Select first tab
+$('#myList a:last-child').tab('show')// Select last tab
+$('#myList a:nth-child(3)').tab('show')// Select third tab
+
Fade effect
+
To make tabs panel fade in, add .fade to each .tab-pane. The first tab pane must also have .show to make the initial content visible.
Selects the given list item and shows its associated pane. Any other list item that was previously selected becomes unselected and its associated pane is hidden. Returns to the caller before the tab pane has actually been shown (for example, before the shown.bs.tab event occurs).
+
$('#someListItem').tab('show')
+
Events
+
When showing a new tab, the events fire in the following order:
+
+
hide.bs.tab (on the current active tab)
+
show.bs.tab (on the to-be-shown tab)
+
hidden.bs.tab (on the previous active tab, the same one as for the hide.bs.tab event)
+
shown.bs.tab (on the newly-active just-shown tab, the same one as for the show.bs.tab event)
+
+
If no tab was already active, the hide.bs.tab and hidden.bs.tab events will not be fired.
+
+
+
+
Event type
+
Description
+
+
+
+
+
show.bs.tab
+
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.bs.tab
+
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.
+
+
+
hide.bs.tab
+
This event fires when a new tab is to be shown (and thus the previous active tab is to be hidden). Use event.target and event.relatedTarget to target the current active tab and the new soon-to-be-active tab, respectively.
+
+
+
hidden.bs.tab
+
This event fires after a new tab is shown (and thus the previous active tab is hidden). Use event.target and event.relatedTarget to target the previous active tab and the new active tab, respectively.
Documentation and examples for Bootstrap’s media object to construct highly repetitive components like blog comments, tweets, and the like.
+
+
+
Example
+
The media object helps build complex and repetitive components where some media is positioned alongside content that doesn’t wrap around said media. Plus, it does this with only two required classes thanks to flexbox.
+
Below is an example of a single media object. Only two classes are required—the wrapping .media and the .media-body around your content. Optional padding and margin can be controlled through spacing utilities.
+
+
+
+
+
+
Media heading
+
Will you do the same for me? It's time to face the music I'm no longer your muse. Heard it's beautiful, be the judge and my girls gonna take a vote. I can feel a phoenix inside of me. Heaven is jealous of our love, angels are crying from up above. Yeah, you take me to utopia.
+
+
+
<divclass="media">
+ <imgsrc="..."class="mr-3"alt="...">
+ <divclass="media-body">
+ <h5class="mt-0">Media heading</h5>
+ <p>Will you do the same for me? It's time to face the music I'm no longer your muse. Heard it's beautiful, be the judge and my girls gonna take a vote. I can feel a phoenix inside of me. Heaven is jealous of our love, angels are crying from up above. Yeah, you take me to utopia.</p>
+ </div>
+</div>
+
+
Flexbug #12: Inline elements aren’t treated as flex items
+
Internet Explorer 10-11 do not render inline elements like links or images (or ::before and ::after pseudo-elements) as flex items. The only workaround is to set a non-inline display value (e.g., block, inline-block, or flex). We suggest using .d-flex, one of our display utilities, as an easy fix.
Media objects can be infinitely nested, though we suggest you stop at some point. Place nested .media within the .media-body of a parent media object.
+
+
+
+
+
+
Media heading
+
Standing on the frontline when the bombs start to fall. Heaven is jealous of our love, angels are crying from up above. Can't replace you with a million rings. Boy, when you're with me I'll give you a taste. There’s no going back. Before you met me I was alright but things were kinda heavy. Heavy is the head that wears the crown.
Greetings loved ones let's take a journey. Yes, we make angels cry, raining down on earth from up above. Give you something good to celebrate. I used to bite my tongue and hold my breath. I'm ma get your heart racing in my skin-tight jeans. As I march alone to a different beat. Summer after high school when we first met. You're so hypnotizing, could you be the devil? Could you be an angel? It's time to bring out the big balloons. Thought that I was the exception. Bikinis, zucchinis, Martinis, no weenies.
+
+
+
+
+
<divclass="media">
+ <imgsrc="..."class="mr-3"alt="...">
+ <divclass="media-body">
+ <h5class="mt-0">Media heading</h5>
+ <p>Standing on the frontline when the bombs start to fall. Heaven is jealous of our love, angels are crying from up above. Can't replace you with a million rings. Boy, when you're with me I'll give you a taste. There’s no going back. Before you met me I was alright but things were kinda heavy. Heavy is the head that wears the crown.</p>
+
+ <divclass="media mt-3">
+ <aclass="mr-3"href="#">
+ <imgsrc="..."alt="...">
+ </a>
+ <divclass="media-body">
+ <h5class="mt-0">Media heading</h5>
+ <p>Greetings loved ones let's take a journey. Yes, we make angels cry, raining down on earth from up above. Give you something good to celebrate. I used to bite my tongue and hold my breath. I'm ma get your heart racing in my skin-tight jeans. As I march alone to a different beat. Summer after high school when we first met. You're so hypnotizing, could you be the devil? Could you be an angel? It's time to bring out the big balloons. Thought that I was the exception. Bikinis, zucchinis, Martinis, no weenies.</p>
+ </div>
+ </div>
+ </div>
+</div>
+
Alignment
+
Media in a media object can be aligned with flexbox utilities to the top (default), middle, or end of your .media-body content.
+
+
+
+
+
+
Top-aligned media
+
I’m gon’ put her in a coma. You give a hundred reasons why, and you say you're really gonna try. So I sat quietly, agreed politely. Suiting up for my crowning battle. And on my 18th Birthday we got matching tattoos. So très chic, yeah, she's a classic. I am ready for the road less traveled.
+
I'm walking on air (tonight). But down to earth. You're original, cannot be replaced. But in another life I would be your girl. We drove to Cali and got drunk on the beach. We can dance, until we die, you and I, will be young forever. Saw you downtown singing the Blues.
+
+
+
<divclass="media">
+ <imgsrc="..."class="align-self-start mr-3"alt="...">
+ <divclass="media-body">
+ <h5class="mt-0">Top-aligned media</h5>
+ <p>I’m gon’ put her in a coma. You give a hundred reasons why, and you say you're really gonna try. So I sat quietly, agreed politely. Suiting up for my crowning battle. And on my 18th Birthday we got matching tattoos. So très chic, yeah, she's a classic. I am ready for the road less traveled.</p>
+ <p>I'm walking on air (tonight). But down to earth. You're original, cannot be replaced. But in another life I would be your girl. We drove to Cali and got drunk on the beach. We can dance, until we die, you and I, will be young forever. Saw you downtown singing the Blues.</p>
+ </div>
+</div>
+
+
+
+
+
+
Center-aligned media
+
She'll turn cold as a freezer. At the eh-end of it all. Stinging like a bee I earned my stripes. Bikinis, zucchinis, Martinis, no weenies. I hope you got a healthy appetite. We can dance, until we die, you and I, will be young forever. We're living the life. We're doing it right. Word on the street, you got somethin' to show me, me.
+
Wanna see the show in 3D, a movie. They say, be afraid you're not like the others, futuristic lover. Open up your heart. So I sat quietly, agreed politely. Last Friday night. Yeah, you're lucky if you're on her plane. I'll be your gift, give you something good to celebrate.
+
+
+
<divclass="media">
+ <imgsrc="..."class="align-self-center mr-3"alt="...">
+ <divclass="media-body">
+ <h5class="mt-0">Center-aligned media</h5>
+ <p>She'll turn cold as a freezer. At the eh-end of it all. Stinging like a bee I earned my stripes. Bikinis, zucchinis, Martinis, no weenies. I hope you got a healthy appetite. We can dance, until we die, you and I, will be young forever. We're living the life. We're doing it right. Word on the street, you got somethin' to show me, me.</p>
+ <pclass="mb-0">Wanna see the show in 3D, a movie. They say, be afraid you're not like the others, futuristic lover. Open up your heart. So I sat quietly, agreed politely. Last Friday night. Yeah, you're lucky if you're on her plane. I'll be your gift, give you something good to celebrate.</p>
+ </div>
+</div>
+
+
+
+
+
+
Bottom-aligned media
+
Come on, let your colours burst. I can feel this light that's inside of me. All night they're playing, your song. From Tokyo to Mexico, to Rio. There’s no going back. But down to earth. Magical, colorful, Mr. Mystery, ee. Different DNA, they don't understand you.
+
But down to earth. She's got that, je ne sais quoi, you know it. I can see the writing on the wall. The boys break their necks try'na to creep a little sneak peek. Take me, ta-ta-take me. Open up your heart. Thought that I was the exception. Boom, boom, boom. Venice beach and Palm Springs, summertime is everything. Bring the beat back. (This is how we do)
+
+
+
<divclass="media">
+ <imgsrc="..."class="align-self-end mr-3"alt="...">
+ <divclass="media-body">
+ <h5class="mt-0">Bottom-aligned media</h5>
+ <p>Come on, let your colours burst. I can feel this light that's inside of me. All night they're playing, your song. From Tokyo to Mexico, to Rio. There’s no going back. But down to earth. Magical, colorful, Mr. Mystery, ee. Different DNA, they don't understand you.</p>
+ <pclass="mb-0">But down to earth. She's got that, je ne sais quoi, you know it. I can see the writing on the wall. The boys break their necks try'na to creep a little sneak peek. Take me, ta-ta-take me. Open up your heart. Thought that I was the exception. Boom, boom, boom. Venice beach and Palm Springs, summertime is everything. Bring the beat back. (This is how we do)</p>
+ </div>
+</div>
+
Order
+
Change the order of content in media objects by modifying the HTML itself, or by adding some custom flexbox CSS to set the order property (to an integer of your choosing).
+
+
+
+
Media object
+
I know there will be sacrifice but that's the price. Are you brave enough to let me see your peacock? Be your teenage dream tonight. Uh-huh, I see you. There’s no going back. Yeah, we maxed our credit cards and got kicked out of the bar. So let me get you in your birthday suit. You may fall in love when you meet her. Had the world in the palm of your hands. Don't let the greatness get you down, oh, oh yeah. Now we talking astrology, getting our nails did, all Japanese-y. Make me your Aphrodite.
+
+
+
+
+
<divclass="media">
+ <divclass="media-body">
+ <h5class="mt-0 mb-1">Media object</h5>
+ <p>I know there will be sacrifice but that's the price. Are you brave enough to let me see your peacock? Be your teenage dream tonight. Uh-huh, I see you. There’s no going back. Yeah, we maxed our credit cards and got kicked out of the bar. So let me get you in your birthday suit. You may fall in love when you meet her. Had the world in the palm of your hands. Don't let the greatness get you down, oh, oh yeah. Now we talking astrology, getting our nails did, all Japanese-y. Make me your Aphrodite.</p>
+ </div>
+ <imgsrc="..."class="ml-3"alt="...">
+</div>
+
Media list
+
Because the media object has so few structural requirements, you can also use these classes on list HTML elements. On your <ul> or <ol>, add the .list-unstyled to remove any browser default list styles, and then apply .media to your <li>s. As always, use spacing utilities wherever needed to fine tune.
+
+
+
+
+
+
+
List-based media object
+
All my girls vintage Chanel baby. So you can have your cake. Tonight, tonight, tonight, I'm walking on air. Slowly swallowing down my fear, yeah yeah. Growing fast into a bolt of lightning. So hot and heavy, 'Til dawn. That fairy tale ending with a knight in shining armor. Heavy is the head that wears the crown.
+
+
+
+
+
+
+
List-based media object
+
Maybe a reason why all the doors are closed. Cause once you’re mine, once you’re mine. Be your teenage dream tonight. Heavy is the head that wears the crown. It's not even a holiday, nothing to celebrate. A perfect storm, perfect storm.
+
+
+
+
+
+
+
List-based media object
+
Are you brave enough to let me see your peacock? There’s no going back. This is the last time you say, after the last line you break. At the eh-end of it all.
+
+
+
+
<ulclass="list-unstyled">
+ <liclass="media">
+ <imgsrc="..."class="mr-3"alt="...">
+ <divclass="media-body">
+ <h5class="mt-0 mb-1">List-based media object</h5>
+ <p>All my girls vintage Chanel baby. So you can have your cake. Tonight, tonight, tonight, I'm walking on air. Slowly swallowing down my fear, yeah yeah. Growing fast into a bolt of lightning. So hot and heavy, 'Til dawn. That fairy tale ending with a knight in shining armor. Heavy is the head that wears the crown.</p>
+ </div>
+ </li>
+ <liclass="media my-4">
+ <imgsrc="..."class="mr-3"alt="...">
+ <divclass="media-body">
+ <h5class="mt-0 mb-1">List-based media object</h5>
+ <p>Maybe a reason why all the doors are closed. Cause once you’re mine, once you’re mine. Be your teenage dream tonight. Heavy is the head that wears the crown. It's not even a holiday, nothing to celebrate. A perfect storm, perfect storm.</p>
+ </div>
+ </li>
+ <liclass="media">
+ <imgsrc="..."class="mr-3"alt="...">
+ <divclass="media-body">
+ <h5class="mt-0 mb-1">List-based media object</h5>
+ <p>Are you brave enough to let me see your peacock? There’s no going back. This is the last time you say, after the last line you break. At the eh-end of it all.</p>
+ </div>
+ </li>
+</ul>
Use Bootstrap’s JavaScript modal plugin to add dialogs to your site for lightboxes, user notifications, or completely custom content.
+
+
+
How it works
+
Before getting started with Bootstrap’s modal component, be sure to read the following as our menu options have recently changed.
+
+
Modals are built with HTML, CSS, and JavaScript. They’re positioned over everything else in the document and remove scroll from the <body> so that modal content scrolls instead.
+
Clicking on the modal “backdrop” will automatically close the modal.
+
Bootstrap only supports one modal window at a time. Nested modals aren’t supported as we believe them to be poor user experiences.
+
Modals use position: fixed, which can sometimes be a bit particular about its rendering. Whenever possible, place your modal HTML in a top-level position to avoid potential interference from other elements. You’ll likely run into issues when nesting a .modal within another fixed element.
+
Once again, due to position: fixed, there are some caveats with using modals on mobile devices. See our browser support docs for details.
+
Due to how HTML5 defines its semantics, the autofocus HTML attribute has no effect in Bootstrap modals. To achieve the same effect, use some custom JavaScript:
Below is a static modal example (meaning its position and display have been overridden). Included are the modal header, modal body (required for padding), and modal footer (optional). We ask that you include modal headers with dismiss actions whenever possible, or provide another explicit dismiss action.
When modals become too long for the user’s viewport or device, they scroll independent of the page itself. Try the demo below to see what we mean.
+
+
+
+
+
Modal title
+
+
+
+
What follows is just some placeholder text for this modal dialog. Sipping on Rosé, Silver Lake sun, coming up all lazy. It’s in the palm of your hand now baby. So we hit the boulevard. So make a wish, I'll make it like your birthday everyday. Do you ever feel already buried deep six feet under? It's time to bring out the big balloons. You could've been the greatest. Passport stamps, she's cosmopolitan. Your kiss is cosmic, every move is magic.
+
We're living the life. We're doing it right. Open up your heart. I was tryna hit it and quit it. Her love is like a drug. Always leaves a trail of stardust. The girl's a freak, she drive a jeep in Laguna Beach. Fine, fresh, fierce, we got it on lock. All my girls vintage Chanel baby.
+
Before you met me I was alright but things were kinda heavy. Peach-pink lips, yeah, everybody stares. This is no big deal. Calling out my name. I could have rewrite your addiction. She's got that, je ne sais quoi, you know it. Heavy is the head that wears the crown. 'Cause, baby, you're a firework. Like thunder gonna shake the ground.
+
Just own the night like the 4th of July! I’m gon’ put her in a coma. What you're waiting for, it's time for you to show it off. Can't replace you with a million rings. You open my eyes and I'm ready to go, lead me into the light. And here you are. I’m gon’ put her in a coma. Come on, let your colours burst. So cover your eyes, I have a surprise. As I march alone to a different beat. Glitter all over the room pink flamingos in the pool.
+
You just gotta ignite the light and let it shine! Come just as you are to me. Just own the night like the 4th of July. Infect me with your love and fill me with your poison. Come just as you are to me. End of the rainbow looking treasure.
+
I can't sleep let's run away and don't ever look back, don't ever look back. I can't sleep let's run away and don't ever look back, don't ever look back. Yes, we make angels cry, raining down on earth from up above. I'm walking on air (tonight). Let you put your hands on me in my skin-tight jeans. Stinging like a bee I earned my stripes. I went from zero, to my own hero. Even brighter than the moon, moon, moon. Make 'em go, 'Aah, aah, aah' as you shoot across the sky-y-y! Why don't you let me stop by?
+
Boom, boom, boom. Never made me blink one time. Yeah, you're lucky if you're on her plane. Talk about our future like we had a clue. Oh my God no exaggeration. You're original, cannot be replaced. The girl's a freak, she drive a jeep in Laguna Beach. It's no big deal, it's no big deal, it's no big deal. In another life I would make you stay. I'm ma get your heart racing in my skin-tight jeans. I wanna walk on your wave length and be there when you vibrate Never made me blink one time.
+
We'd keep all our promises be us against the world. If you get the chance you better keep her. It's time to bring out the big, big, big, big, big, big balloons. I hope you got a healthy appetite. Don't let the greatness get you down, oh, oh yeah. Yeah, she's footloose and so fancy free. I want the jaw droppin', eye poppin', head turnin', body shockin'. End of the rainbow looking treasure.
+
+
+
+
+
+
+
+
+
You can also create a scrollable modal that allows scroll the modal body by adding .modal-dialog-scrollable to .modal-dialog.
+
+
+
+
+
Modal title
+
+
+
+
What follows is just some placeholder text for this modal dialog. You just gotta ignite the light and let it shine! Come just as you are to me. Just own the night like the 4th of July. Infect me with your love and fill me with your poison. Come just as you are to me. End of the rainbow looking treasure.
+
I can't sleep let's run away and don't ever look back, don't ever look back. I can't sleep let's run away and don't ever look back, don't ever look back. Yes, we make angels cry, raining down on earth from up above. I'm walking on air (tonight). Let you put your hands on me in my skin-tight jeans. Stinging like a bee I earned my stripes. I went from zero, to my own hero. Even brighter than the moon, moon, moon. Make 'em go, 'Aah, aah, aah' as you shoot across the sky-y-y! Why don't you let me stop by?
+
Boom, boom, boom. Never made me blink one time. Yeah, you're lucky if you're on her plane. Talk about our future like we had a clue. Oh my God no exaggeration. You're original, cannot be replaced. The girl's a freak, she drive a jeep in Laguna Beach. It's no big deal, it's no big deal, it's no big deal. In another life I would make you stay. I'm ma get your heart racing in my skin-tight jeans. I wanna walk on your wave length and be there when you vibrate Never made me blink one time.
+
We'd keep all our promises be us against the world. In another life I would be your girl. We can dance, until we die, you and I, will be young forever. And on my 18th Birthday we got matching tattoos. So open up your heart and just let it begin. 'Cause she's the muse and the artist. She eats your heart out. Like Jeffrey Dahmer (woo). Pop your confetti. (This is how we do) I know one spark will shock the world, yeah yeah. If you only knew what the future holds.
+
Sipping on Rosé, Silver Lake sun, coming up all lazy. It’s in the palm of your hand now baby. So we hit the boulevard. So make a wish, I'll make it like your birthday everyday. Do you ever feel already buried deep six feet under? It's time to bring out the big balloons. You could've been the greatest. Passport stamps, she's cosmopolitan. Your kiss is cosmic, every move is magic.
+
We're living the life. We're doing it right. Open up your heart. I was tryna hit it and quit it. Her love is like a drug. Always leaves a trail of stardust. The girl's a freak, she drive a jeep in Laguna Beach. Fine, fresh, fierce, we got it on lock. All my girls vintage Chanel baby.
+
Before you met me I was alright but things were kinda heavy. Peach-pink lips, yeah, everybody stares. This is no big deal. Calling out my name. I could have rewrite your addiction. She's got that, je ne sais quoi, you know it. Heavy is the head that wears the crown. 'Cause, baby, you're a firework. Like thunder gonna shake the ground.
+
Just own the night like the 4th of July! I’m gon’ put her in a coma. What you're waiting for, it's time for you to show it off. Can't replace you with a million rings. You open my eyes and I'm ready to go, lead me into the light. And here you are. I’m gon’ put her in a coma. Come on, let your colours burst. So cover your eyes, I have a surprise. As I march alone to a different beat. Glitter all over the room pink flamingos in the pool.
Add .modal-dialog-centered to .modal-dialog to vertically center the modal.
+
+
+
+
+
Modal title
+
+
+
+
Placeholder text for this demonstration of a vertically centered modal dialog.
+
+
+
+
+
+
+
+
+
+
Modal title
+
+
+
+
Placeholder text for this demonstration of a vertically centered modal dialog.
+
In this case, the dialog has a bit more content, just to show how vertical centering can be added to a scrollable modal.
+
What follows is just some placeholder text for this modal dialog. Sipping on Rosé, Silver Lake sun, coming up all lazy. It’s in the palm of your hand now baby. So we hit the boulevard. So make a wish, I'll make it like your birthday everyday. Do you ever feel already buried deep six feet under? It's time to bring out the big balloons. You could've been the greatest. Passport stamps, she's cosmopolitan. Your kiss is cosmic, every move is magic.
+
We're living the life. We're doing it right. Open up your heart. I was tryna hit it and quit it. Her love is like a drug. Always leaves a trail of stardust. The girl's a freak, she drive a jeep in Laguna Beach. Fine, fresh, fierce, we got it on lock. All my girls vintage Chanel baby.
Tooltips and popovers can be placed within modals as needed. When modals are closed, any tooltips and popovers within are also automatically dismissed.
<divclass="modal-body">
+ <h5>Popover in a modal</h5>
+ <p>This <ahref="#"role="button"class="btn btn-secondary popover-test"title="Popover title"data-content="Popover body content is set in this attribute.">button</a> triggers a popover on click.</p>
+ <hr>
+ <h5>Tooltips in a modal</h5>
+ <p><ahref="#"class="tooltip-test"title="Tooltip">This link</a> and <ahref="#"class="tooltip-test"title="Tooltip">that link</a> have tooltips on hover.</p>
+</div>
+
Using the grid
+
Utilize the Bootstrap grid system within a modal by nesting .container-fluid within the .modal-body. Then, use the normal grid system classes as you would anywhere else.
Have a bunch of buttons that all trigger the same modal with slightly different contents? Use event.relatedTarget and HTML data-* attributes (possibly via jQuery) to vary the contents of the modal depending on which button was clicked.
+
Below is a live demo followed by example HTML and JavaScript. For more information, read the modal events docs for details on relatedTarget.
$('#exampleModal').on('show.bs.modal',function(event){
+ varbutton=$(event.relatedTarget)// Button that triggered the modal
+varrecipient=button.data('whatever')// Extract info from data-* attributes
+// If necessary, you could initiate an AJAX request here (and then do the updating in a callback).
+// Update the modal's content. We'll use jQuery here, but you could use a data binding library or other methods instead.
+varmodal=$(this)
+ modal.find('.modal-title').text('New message to '+recipient)
+ modal.find('.modal-body input').val(recipient)
+})
+
Change animation
+
The $modal-fade-transform variable determines the transform state of .modal-dialog before the modal fade-in animation, the $modal-show-transform variable determines the transform of .modal-dialog at the end of the modal fade-in animation.
+
If you want for example a zoom-in animation, you can set $modal-fade-transform: scale(.8).
+
Remove animation
+
For modals that simply appear rather than fade in to view, remove the .fade class from your modal markup.
If the height of a modal changes while it is open, you should call $('#myModal').modal('handleUpdate') to readjust the modal’s position in case a scrollbar appears.
+
Accessibility
+
Be sure to add aria-labelledby="...", referencing the modal title, to .modal. Additionally, you may give a description of your modal dialog with aria-describedby on .modal. Note that you don’t need to add role="dialog" since we already add it via JavaScript.
+
Embedding YouTube videos
+
Embedding YouTube videos in modals requires additional JavaScript not in Bootstrap to automatically stop playback and more. See this helpful Stack Overflow post for more information.
+
Optional sizes
+
Modals have three optional sizes, available via modifier classes to be placed on a .modal-dialog. These sizes kick in at certain breakpoints to avoid horizontal scrollbars on narrower viewports.
+
+
+
+
Size
+
Class
+
Modal max-width
+
+
+
+
+
Small
+
.modal-sm
+
300px
+
+
+
Default
+
None
+
500px
+
+
+
Large
+
.modal-lg
+
800px
+
+
+
Extra large
+
.modal-xl
+
1140px
+
+
+
+
Our default modal without modifier class constitutes the “medium” size modal.
The modal plugin toggles your hidden content on demand, via data attributes or JavaScript. It also adds .modal-open to the <body> to override default scrolling behavior and generates a .modal-backdrop to provide a click area for dismissing shown modals when clicking outside the modal.
+
Via data attributes
+
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.
Call a modal with id myModal with a single line of JavaScript:
+
$('#myModal').modal(options)
+
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 or the string 'static'
+
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
+
+
+
focus
+
boolean
+
true
+
Puts the focus on the modal when initialized.
+
+
+
show
+
boolean
+
true
+
Shows the modal when initialized.
+
+
+
+
Methods
+
+
Asynchronous methods and transitions
+
All API methods are asynchronous and start a transition. They return to the caller as soon as the transition is started but before it ends. In addition, a method call on a transitioning component will be ignored.
Activates your content as a modal. Accepts an optional options object.
+
$('#myModal').modal({
+ keyboard:false
+})
+
.modal('toggle')
+
Manually toggles a modal. Returns to the caller before the modal has actually been shown or hidden (i.e. before the shown.bs.modal or hidden.bs.modal event occurs).
+
$('#myModal').modal('toggle')
+
.modal('show')
+
Manually opens a modal. Returns to the caller before the modal has actually been shown (i.e. before the shown.bs.modal event occurs).
+
$('#myModal').modal('show')
+
.modal('hide')
+
Manually hides a modal. Returns to the caller before the modal has actually been hidden (i.e. before the hidden.bs.modal event occurs).
+
$('#myModal').modal('hide')
+
.modal('handleUpdate')
+
Manually readjust the modal’s position if the height of a modal changes while it is open (i.e. in case a scrollbar appears).
+
$('#myModal').modal('handleUpdate')
+
.modal('dispose')
+
Destroys an element’s modal.
+
Events
+
Bootstrap’s modal class exposes a few events for hooking into modal functionality. All modal events are fired at the modal itself (i.e. at the <div class="modal">).
+
+
+
+
Event Type
+
Description
+
+
+
+
+
show.bs.modal
+
This event fires immediately when the show instance method is called. If caused by a click, the clicked element is available as the relatedTarget property of the event.
+
+
+
shown.bs.modal
+
This event is fired when the modal has been made visible to the user (will wait for CSS transitions to complete). If caused by a click, the clicked element is available as the relatedTarget property of the event.
+
+
+
hide.bs.modal
+
This event is fired immediately when the hide instance method has been called.
+
+
+
hidden.bs.modal
+
This event is fired when the modal has finished being hidden from the user (will wait for CSS transitions to complete).
+
+
+
hidePrevented.bs.modal
+
This event is fired when the modal is shown, its backdrop is static and a click outside the modal or an escape key press is performed with the keyboard option or data-keyboard set to false.
+
+
+
+
$('#myModal').on('hidden.bs.modal',function(event){
+ // do something...
+})
+
Documentation and examples for Bootstrap’s powerful, responsive navigation header, the navbar. Includes support for branding, navigation, and more, including support for our collapse plugin.
+
+
+
How it works
+
Here’s what you need to know before getting started with the navbar:
+
+
Navbars require a wrapping .navbar with .navbar-expand{-sm|-md|-lg|-xl} for responsive collapsing and color scheme classes.
+
Navbars and their contents are fluid by default. Use optional containers to limit their horizontal width.
+
Use our spacing and flex utility classes for controlling spacing and alignment within navbars.
+
Navbars are responsive by default, but you can easily modify them to change that. Responsive behavior depends on our Collapse JavaScript plugin.
+
Navbars are hidden by default when printing. Force them to be printed by adding .d-print to the .navbar. See the display utility class.
+
Ensure accessibility by using a <nav> element or, if using a more generic element such as a <div>, add a role="navigation" to every navbar to explicitly identify it as a landmark region for users of assistive technologies.
<!-- As a link -->
+<navclass="navbar navbar-light bg-light">
+ <aclass="navbar-brand"href="#">Navbar</a>
+</nav>
+
+<!-- As a heading -->
+<navclass="navbar navbar-light bg-light">
+ <spanclass="navbar-brand mb-0 h1">Navbar</span>
+</nav>
+
Adding images to the .navbar-brand will likely always require custom styles or utilities to properly size. Here are some examples to demonstrate.
<!-- Image and text -->
+<navclass="navbar navbar-light bg-light">
+ <aclass="navbar-brand"href="#">
+ <imgsrc="/docs/4.6/assets/brand/bootstrap-solid.svg"width="30"height="30"class="d-inline-block align-top"alt="">
+ Bootstrap
+ </a>
+</nav>
+
Nav
+
Navbar navigation links build on our .nav options with their own modifier class and require the use of toggler classes for proper responsive styling. Navigation in navbars will also grow to occupy as much horizontal space as possible to keep your navbar contents securely aligned.
+
Active states—with .active—to indicate the current page can be applied directly to .nav-links or their immediate parent .nav-items.
You can also use dropdowns in your navbar. Dropdown menus require a wrapping element for positioning, so be sure to use separate and nested elements for .nav-item and .nav-link as shown below.
Immediate child elements of .navbar use flex layout and will default to justify-content: space-between. Use additional flex utilities as needed to adjust this behavior.
Various buttons are supported as part of these navbar forms, too. This is also a great reminder that vertical alignment utilities can be used to align different sized elements.
Theming the navbar has never been easier thanks to the combination of theming classes and background-color utilities. Choose from .navbar-light for use with light background colors, or .navbar-dark for dark background colors. Then, customize with .bg-* utilities.
Although it’s not required, you can wrap a navbar in a .container to center it on a page. Or you can add a container inside the .navbar to only center the contents of a fixed or static top navbar.
When the container is within your navbar, its horizontal padding is removed at breakpoints lower than your specified .navbar-expand{-sm|-md|-lg|-xl} class. This ensures we’re not doubling up on padding unnecessarily on lower viewports when your navbar is collapsed.
Use our position utilities to place navbars in non-static positions. Choose from fixed to the top, fixed to the bottom, or stickied to the top (scrolls with the page until it reaches the top, then stays there). Fixed navbars use position: fixed, meaning they’re pulled from the normal flow of the DOM and may require custom CSS (e.g., padding-top on the <body>) to prevent overlap with other elements.
Add .navbar-nav-scroll to a .navbar-collapse (or other navbar sub-component) to enable vertical scrolling within the toggleable contents of a collapsed navbar. By default, scrolling kicks in at 75vh (or 75% of the viewport height), but you can override that with inline or custom styles. At larger viewports when the navbar is expanded, content will appear as it does in a default navbar.
+
Please note that this behavior comes with a potential drawback of overflow—when setting overflow-y: auto (required to scroll the content here), overflow-x is the equivalent of auto, which will crop some horizontal content.
+
Here’s an example navbar using .navbar-nav-scroll with style="max-height: 100px;", with some extra margin utilities for optimum spacing.
Navbars can use .navbar-toggler, .navbar-collapse, and .navbar-expand{-sm|-md|-lg|-xl} classes to determine when their content collapses behind a button. In combination with other utilities, you can easily choose when to show or hide particular elements.
+
For navbars that never collapse, add the .navbar-expand class on the navbar. For navbars that always collapse, don’t add any .navbar-expand class.
+
Toggler
+
Navbar togglers are left-aligned by default, but should they follow a sibling element like a .navbar-brand, they’ll automatically be aligned to the far right. Reversing your markup will reverse the placement of the toggler. Below are examples of different toggle styles.
+
With no .navbar-brand shown at the smallest breakpoint:
Sometimes you want to use the collapse plugin to trigger a container element for content that structurally sits outside of the .navbar . Because our plugin works on the id and data-target matching, that’s easily done!
When you do this, we recommend including additional JavaScript to move the focus programmatically to the container when it is opened. Otherwise, keyboard users and users of assistive technologies will likely have a hard time finding the newly revealed content - particularly if the container that was opened comes before the toggler in the document’s structure. We also recommend making sure that the toggler has the aria-controls attribute, pointing to the id of the content container. In theory, this allows assistive technology users to jump directly from the toggler to the container it controls–but support for this is currently quite patchy.
Documentation and examples for how to use Bootstrap’s included navigation components.
+
+
+
Base nav
+
Navigation available in Bootstrap share general markup and styles, from the base .nav class to the active and disabled states. Swap modifier classes to switch between each style.
+
The base .nav component is built with flexbox and provide a strong foundation for building all types of navigation components. It includes some style overrides (for working with lists), some link padding for larger hit areas, and basic disabled styling.
+
+The base .nav component does not include any .active state. The following examples include the class, mainly to demonstrate that this particular class does not trigger any special styling.
+
Classes are used throughout, so your markup can be super flexible. Use <ul>s like above, <ol> if the order of your items is important, or roll your own with a <nav> element. Because the .nav uses display: flex, the nav links behave the same as nav items would, but without the extra markup.
Change the style of .navs component with modifiers and utilities. Mix and match as needed, or build your own.
+
Horizontal alignment
+
Change the horizontal alignment of your nav with flexbox utilities. By default, navs are left-aligned, but you can easily change them to center or right aligned.
Stack your navigation by changing the flex item direction with the .flex-column utility. Need to stack them on some viewports but not others? Use the responsive versions (e.g., .flex-sm-column).
Takes the basic nav from above and adds the .nav-tabs class to generate a tabbed interface. Use them to create tabbable regions with our tab JavaScript plugin.
Force your .nav’s contents to extend the full available width one of two modifier classes. To proportionately fill all available space with your .nav-items, use .nav-fill. Notice that all horizontal space is occupied, but not every nav item has the same width.
For equal-width elements, use .nav-justified. All horizontal space will be occupied by nav links, but unlike the .nav-fill above, every nav item will be the same width.
If you need responsive nav variations, consider using a series of flexbox utilities. While more verbose, these utilities offer greater customization across responsive breakpoints. In the example below, our nav will be stacked on the lowest breakpoint, then adapt to a horizontal layout that fills the available width starting from the small breakpoint.
If you’re using navs to provide a navigation bar, be sure to add a role="navigation" to the most logical parent container of the <ul>, or wrap a <nav> element around the whole navigation. Do not add the role to the <ul> itself, as this would prevent it from being announced as an actual list by assistive technologies.
+
Note that navigation bars, even if visually styled as tabs with the .nav-tabs class, should not be given role="tablist", role="tab" or role="tabpanel" attributes. These are only appropriate for dynamic tabbed interfaces, as described in the WAI ARIA Authoring Practices. See JavaScript behavior for dynamic tabbed interfaces in this section for an example.
Use the tab JavaScript plugin—include it individually or through the compiled bootstrap.js file—to extend our navigational tabs and pills to create tabbable panes of local content.
+
If you’re building our JavaScript from source, it requires util.js.
+
Dynamic tabbed interfaces, as described in the WAI ARIA Authoring Practices, require role="tablist", role="tab", role="tabpanel", and additional aria- attributes in order to convey their structure, functionality and current state to users of assistive technologies (such as screen readers).
+
Note that dynamic tabbed interfaces should not contain dropdown menus, as this causes both usability and accessibility issues. From a usability perspective, the fact that the currently displayed tab’s trigger element is not immediately visible (as it’s inside the closed dropdown menu) can cause confusion. From an accessibility point of view, there is currently no sensible way to map this sort of construct to a standard WAI ARIA pattern, meaning that it cannot be easily made understandable to users of assistive technologies.
Placeholder content for the tab panel. This one relates to the home tab. Takes you miles high, so high, 'cause she’s got that one international smile. There's a stranger in my bed, there's a pounding in my head. Oh, no. In another life I would make you stay. ‘Cause I, I’m capable of anything. Suiting up for my crowning battle. Used to steal your parents' liquor and climb to the roof. Tone, tan fit and ready, turn it up cause its gettin' heavy. Her love is like a drug. I guess that I forgot I had a choice.
+
+
+
Placeholder content for the tab panel. This one relates to the profile tab. You got the finest architecture. Passport stamps, she's cosmopolitan. Fine, fresh, fierce, we got it on lock. Never planned that one day I'd be losing you. She eats your heart out. Your kiss is cosmic, every move is magic. I mean the ones, I mean like she's the one. Greetings loved ones let's take a journey. Just own the night like the 4th of July! But you'd rather get wasted.
+
+
+
Placeholder content for the tab panel. This one relates to the contact tab. Her love is like a drug. All my girls vintage Chanel baby. Got a motel and built a fort out of sheets. 'Cause she's the muse and the artist. (This is how we do) So you wanna play with magic. So just be sure before you give it all to me. I'm walking, I'm walking on air (tonight). Skip the talk, heard it all, time to walk the walk. Catch her if you can. Stinging like a bee I earned my stripes.
To help fit your needs, this works with <ul>-based markup, as shown above, or with any arbitrary “roll your own” markup. Note that if you’re using <nav>, you shouldn’t add role="tablist" directly to it, as this would override the element’s native role as a navigation landmark. Instead, switch to an alternative element (in the example below, a simple <div>) and wrap the <nav> around it.
Placeholder content for the tab panel. This one relates to the home tab. Takes you miles high, so high, 'cause she’s got that one international smile. There's a stranger in my bed, there's a pounding in my head. Oh, no. In another life I would make you stay. ‘Cause I, I’m capable of anything. Suiting up for my crowning battle. Used to steal your parents' liquor and climb to the roof. Tone, tan fit and ready, turn it up cause its gettin' heavy. Her love is like a drug. I guess that I forgot I had a choice.
+
+
+
Placeholder content for the tab panel. This one relates to the profile tab. You got the finest architecture. Passport stamps, she's cosmopolitan. Fine, fresh, fierce, we got it on lock. Never planned that one day I'd be losing you. She eats your heart out. Your kiss is cosmic, every move is magic. I mean the ones, I mean like she's the one. Greetings loved ones let's take a journey. Just own the night like the 4th of July! But you'd rather get wasted.
+
+
+
Placeholder content for the tab panel. This one relates to the contact tab. Her love is like a drug. All my girls vintage Chanel baby. Got a motel and built a fort out of sheets. 'Cause she's the muse and the artist. (This is how we do) So you wanna play with magic. So just be sure before you give it all to me. I'm walking, I'm walking on air (tonight). Skip the talk, heard it all, time to walk the walk. Catch her if you can. Stinging like a bee I earned my stripes.
Placeholder content for the tab panel. This one relates to the home tab. Takes you miles high, so high, 'cause she’s got that one international smile. There's a stranger in my bed, there's a pounding in my head. Oh, no. In another life I would make you stay. ‘Cause I, I’m capable of anything. Suiting up for my crowning battle. Used to steal your parents' liquor and climb to the roof. Tone, tan fit and ready, turn it up cause its gettin' heavy. Her love is like a drug. I guess that I forgot I had a choice.
+
+
+
Placeholder content for the tab panel. This one relates to the profile tab. You got the finest architecture. Passport stamps, she's cosmopolitan. Fine, fresh, fierce, we got it on lock. Never planned that one day I'd be losing you. She eats your heart out. Your kiss is cosmic, every move is magic. I mean the ones, I mean like she's the one. Greetings loved ones let's take a journey. Just own the night like the 4th of July! But you'd rather get wasted.
+
+
+
Placeholder content for the tab panel. This one relates to the contact tab. Her love is like a drug. All my girls vintage Chanel baby. Got a motel and built a fort out of sheets. 'Cause she's the muse and the artist. (This is how we do) So you wanna play with magic. So just be sure before you give it all to me. I'm walking, I'm walking on air (tonight). Skip the talk, heard it all, time to walk the walk. Catch her if you can. Stinging like a bee I earned my stripes.
Placeholder content for the tab panel. This one relates to the home tab. Saw you downtown singing the Blues. Watch you circle the drain. Why don't you let me stop by? Heavy is the head that wears the crown. Yes, we make angels cry, raining down on earth from up above. Wanna see the show in 3D, a movie. Do you ever feel, feel so paper thin. It’s a yes or no, no maybe.
+
+
+
Placeholder content for the tab panel. This one relates to the profile tab. Takes you miles high, so high, 'cause she’s got that one international smile. There's a stranger in my bed, there's a pounding in my head. Oh, no. In another life I would make you stay. ‘Cause I, I’m capable of anything. Suiting up for my crowning battle. Used to steal your parents' liquor and climb to the roof. Tone, tan fit and ready, turn it up cause its gettin' heavy. Her love is like a drug. I guess that I forgot I had a choice.
+
+
+
Placeholder content for the tab panel. This one relates to the messages tab. You got the finest architecture. Passport stamps, she's cosmopolitan. Fine, fresh, fierce, we got it on lock. Never planned that one day I'd be losing you. She eats your heart out. Your kiss is cosmic, every move is magic. I mean the ones, I mean like she's the one. Greetings loved ones let's take a journey. Just own the night like the 4th of July! But you'd rather get wasted.
+
+
+
Placeholder content for the tab panel. This one relates to the settings tab. Her love is like a drug. All my girls vintage Chanel baby. Got a motel and built a fort out of sheets. 'Cause she's the muse and the artist. (This is how we do) So you wanna play with magic. So just be sure before you give it all to me. I'm walking, I'm walking on air (tonight). Skip the talk, heard it all, time to walk the walk. Catch her if you can. Stinging like a bee I earned my stripes.
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. Use these data attributes on .nav-tabs or .nav-pills.
$('#myTab a[href="#profile"]').tab('show')// Select tab by name
+$('#myTab li:first-child a').tab('show')// Select first tab
+$('#myTab li:last-child a').tab('show')// Select last tab
+$('#myTab li:nth-child(3) a').tab('show')// Select third tab
+
Fade effect
+
To make tabs fade in, add .fade to each .tab-pane. The first tab pane must also have .show to make the initial content visible.
All API methods are asynchronous and start a transition. They return to the caller as soon as the transition is started but before it ends. In addition, a method call on a transitioning component will be ignored.
Selects the given tab and shows its associated pane. Any other tab that was previously selected becomes unselected and its associated pane is hidden. Returns to the caller before the tab pane has actually been shown (i.e. before the shown.bs.tab event occurs).
+
$('#someTab').tab('show')
+
.tab(‘dispose’)
+
Destroys an element’s tab.
+
Events
+
When showing a new tab, the events fire in the following order:
+
+
hide.bs.tab (on the current active tab)
+
show.bs.tab (on the to-be-shown tab)
+
hidden.bs.tab (on the previous active tab, the same one as for the hide.bs.tab event)
+
shown.bs.tab (on the newly-active just-shown tab, the same one as for the show.bs.tab event)
+
+
If no tab was already active, then the hide.bs.tab and hidden.bs.tab events will not be fired.
+
+
+
+
Event Type
+
Description
+
+
+
+
+
show.bs.tab
+
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.bs.tab
+
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.
+
+
+
hide.bs.tab
+
This event fires when a new tab is to be shown (and thus the previous active tab is to be hidden). Use event.target and event.relatedTarget to target the current active tab and the new soon-to-be-active tab, respectively.
+
+
+
hidden.bs.tab
+
This event fires after a new tab is shown (and thus the previous active tab is hidden). Use event.target and event.relatedTarget to target the previous active tab and the new active tab, respectively.
Documentation and examples for showing pagination to indicate a series of related content exists across multiple pages.
+
+
+
Overview
+
We use a large block of connected links for our pagination, making links hard to miss and easily scalable—all while providing large hit areas. Pagination is built with list HTML elements so screen readers can announce the number of available links. Use a wrapping <nav> element to identify it as a navigation section to screen readers and other assistive technologies.
+
In addition, as pages likely have more than one such navigation section, it’s advisable to provide a descriptive aria-label for the <nav> to reflect its purpose. For example, if the pagination component is used to navigate between a set of search results, an appropriate label could be aria-label="Search results pages".
Pagination links are customizable for different circumstances. Use .disabled for links that appear un-clickable and .active to indicate the current page.
+
While the .disabled class uses pointer-events: none to try to disable the link functionality of <a>s, that CSS property is not yet standardized and doesn’t account for keyboard navigation. As such, you should always add tabindex="-1" on disabled links and use custom JavaScript to fully disable their functionality.
You can optionally swap out active or disabled anchors for <span>, or omit the anchor in the case of the prev/next arrows, to remove click functionality and prevent keyboard focus while retaining intended styles.
Documentation and examples for adding Bootstrap popovers, like those found in iOS, to any element on your site.
+
+
+
Overview
+
Things to know when using the popover plugin:
+
+
Popovers rely on the 3rd party library Popper for positioning. You must include popper.min.js before bootstrap.js or use bootstrap.bundle.min.js / bootstrap.bundle.js which contains Popper in order for popovers to work!
If you’re building our JavaScript from source, it requires util.js.
+
Popovers are opt-in for performance reasons, so you must initialize them yourself.
+
Zero-length title and content values will never show a popover.
+
Specify container: 'body' to avoid rendering problems in more complex components (like our input groups, button groups, etc).
+
Triggering popovers on hidden elements will not work.
+
Popovers for .disabled or disabled elements must be triggered on a wrapper element.
+
When triggered from anchors that wrap across multiple lines, popovers will be centered between the anchors' overall width. Use .text-nowrap on your <a>s to avoid this behavior.
+
Popovers must be hidden before their corresponding elements have been removed from the DOM.
+
Popovers can be triggered thanks to an element inside a shadow DOM.
When you have some styles on a parent element that interfere with a popover, you’ll want to specify a custom container so that the popover’s HTML appears within that element instead.
<buttontype="button"class="btn btn-lg btn-danger"data-toggle="popover"title="Popover title"data-content="And here's some amazing content. It's very engaging. Right?">Click to toggle popover</button>
+
Four directions
+
Four options are available: top, right, bottom, and left aligned.
+
+
+
+
+
+
<buttontype="button"class="btn btn-secondary"data-container="body"data-toggle="popover"data-placement="top"data-content="Top popover">
+ Popover on top
+</button>
+<buttontype="button"class="btn btn-secondary"data-container="body"data-toggle="popover"data-placement="right"data-content="Right popover">
+ Popover on right
+</button>
+<buttontype="button"class="btn btn-secondary"data-container="body"data-toggle="popover"data-placement="bottom"data-content="Bottom popover">
+ Popover on bottom
+</button>
+<buttontype="button"class="btn btn-secondary"data-container="body"data-toggle="popover"data-placement="left"data-content="Left popover">
+ Popover on left
+</button>
+
Dismiss on next click
+
Use the focus trigger to dismiss popovers on the user’s next click of a different element than the toggle element.
+
+
Specific markup required for dismiss-on-next-click
+
For proper cross-browser and cross-platform behavior, you must use the <a> tag, not the <button> tag, and you also must include a tabindex attribute.
+
Elements with the disabled attribute aren’t interactive, meaning users cannot hover or click them to trigger a popover (or tooltip). As a workaround, you’ll want to trigger the popover from a wrapper <div> or <span> and override the pointer-events on the disabled element.
+
For disabled popover triggers, you may also prefer data-trigger="hover" so that the popover appears as immediate visual feedback to your users as they may not expect to click on a disabled element.
Popovers sometimes appear blurry on Windows 10 devices due to GPU acceleration and a modified system DPI. The workaround for this in v4 is to disable GPU acceleration as needed on your popovers.
Making popovers work for keyboard and assistive technology users
+
To allow keyboard users to activate your popovers, you should only add them to HTML elements that are traditionally keyboard-focusable and interactive (such as links or form controls). Although arbitrary HTML elements (such as <span>s) can be made focusable by adding the tabindex="0" attribute, this will add potentially annoying and confusing tab stops on non-interactive elements for keyboard users, and most assistive technologies currently do not announce the popover’s content in this situation. Additionally, do not rely solely on hover as the trigger for your popovers, as this will make them impossible to trigger for keyboard users.
+
While you can insert rich, structured HTML in popovers with the html option, we strongly recommend that you avoid adding an excessive amount of content. The way popovers currently work is that, once displayed, their content is tied to the trigger element with the aria-describedby attribute. As a result, the entirety of the popover’s content will be announced to assistive technology users as one long, uninterrupted stream.
+
Additionally, while it is possible to also include interactive controls (such as form elements or links) in your popover (by adding these elements to the whiteList or allowed attributes and tags), be aware that currently the popover does not manage keyboard focus order. When a keyboard user opens a popover, focus remains on the triggering element, and as the popover usually does not immediately follow the trigger in the document’s structure, there is no guarantee that moving forward/pressing TAB will move a keyboard user into the popover itself. In short, simply adding interactive controls to a popover is likely to make these controls unreachable/unusable for keyboard users and users of assistive technologies, or at the very least make for an illogical overall focus order. In these cases, consider using a modal dialog instead.
+
+
+
+
Options
+
Options can be passed via data attributes or JavaScript. For data attributes, append the option name to data-, as in data-animation="".
+
+Note that for security reasons the sanitize, sanitizeFn and whiteList options cannot be supplied using data attributes.
+
+
+
+
+
+
Name
+
Type
+
Default
+
Description
+
+
+
+
+
animation
+
boolean
+
true
+
Apply a CSS fade transition to the popover
+
+
+
container
+
string | element | false
+
false
+
+
Appends the popover to a specific element. Example: container: 'body'. This option is particularly useful in that it allows you to position the popover in the flow of the document near the triggering element - which will prevent the popover from floating away from the triggering element during a window resize.
+
+
+
+
content
+
string | element | function
+
''
+
+
Default content value if data-content attribute isn't present.
+
If a function is given, it will be called with its this reference set to the element that the popover is attached to.
+
+
+
+
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: delay: { "show": 500, "hide": 100 }
+
+
+
+
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 - auto | top | bottom | left | right. When auto is specified, it will dynamically reorient the popover.
+
When a function is used to determine the placement, it is called with the popover DOM node as its first argument and the triggering element DOM node as its second. The this context is set to the popover instance.
+
+
+
+
selector
+
string | false
+
false
+
If a selector is provided, popover objects will be delegated to the specified targets. In practice, this is used to enable dynamic HTML content to have popovers added. See this and an informative example.
The popover's title will be injected into the .popover-header.
+
The popover's content will be injected into the .popover-body.
+
.arrow will become the popover's arrow.
+
The outermost wrapper element should have the .popover class.
+
+
+
+
title
+
string | element | function
+
''
+
+
Default title value if title attribute isn't present.
+
If a function is given, it will be called with its this reference set to the element that the popover is attached to.
+
+
+
+
trigger
+
string
+
'click'
+
How popover is triggered - click | hover | focus | manual. You may pass multiple triggers; separate them with a space. manual cannot be combined with any other trigger.
+
+
+
offset
+
number | string
+
0
+
Offset of the popover relative to its target. For more information refer to Popper's offset docs.
+
+
+
fallbackPlacement
+
string | array
+
'flip'
+
Allow to specify which position Popper will use on fallback. For more information refer to
+ Popper's behavior docs
+
+
+
customClass
+
string | function
+
''
+
+
Add classes to the popover when it is shown. Note that these classes will be added in addition to any classes specified in the template. To add multiple classes, separate them with spaces: 'a b'.
+
You can also pass a function that should return a single string containing additional class names.
+
+
+
+
boundary
+
string | element
+
'scrollParent'
+
Overflow constraint boundary of the popover. Accepts the values of 'viewport', 'window', 'scrollParent', or an HTMLElement reference (JavaScript only). For more information refer to Popper's preventOverflow docs.
+
+
+
sanitize
+
boolean
+
true
+
Enable or disable the sanitization. If activated 'template', 'content' and 'title' options will be sanitized.
Options for individual popovers can alternatively be specified through the use of data attributes, as explained above.
+
+
+
Methods
+
+
Asynchronous methods and transitions
+
All API methods are asynchronous and start a transition. They return to the caller as soon as the transition is started but before it ends. In addition, a method call on a transitioning component will be ignored.
Reveals an element’s popover. Returns to the caller before the popover has actually been shown (i.e. before the shown.bs.popover event occurs). This is considered a “manual” triggering of the popover. Popovers whose title and content are both zero-length are never displayed.
+
$('#element').popover('show')
+
.popover('hide')
+
Hides an element’s popover. Returns to the caller before the popover has actually been hidden (i.e. before the hidden.bs.popover event occurs). This is considered a “manual” triggering of the popover.
+
$('#element').popover('hide')
+
.popover('toggle')
+
Toggles an element’s popover. Returns to the caller before the popover has actually been shown or hidden (i.e. before the shown.bs.popover or hidden.bs.popover event occurs). This is considered a “manual” triggering of the popover.
+
$('#element').popover('toggle')
+
.popover('dispose')
+
Hides and destroys an element’s popover. Popovers that use delegation (which are created using the selector option) cannot be individually destroyed on descendant trigger elements.
+
$('#element').popover('dispose')
+
.popover('enable')
+
Gives an element’s popover the ability to be shown. Popovers are enabled by default.
+
$('#element').popover('enable')
+
.popover('disable')
+
Removes the ability for an element’s popover to be shown. The popover will only be able to be shown if it is re-enabled.
+
$('#element').popover('disable')
+
.popover('toggleEnabled')
+
Toggles the ability for an element’s popover to be shown or hidden.
+
$('#element').popover('toggleEnabled')
+
.popover('update')
+
Updates the position of an element’s popover.
+
$('#element').popover('update')
+
Events
+
+
+
+
Event Type
+
Description
+
+
+
+
+
show.bs.popover
+
This event fires immediately when the show instance method is called.
+
+
+
shown.bs.popover
+
This event is fired when the popover has been made visible to the user (will wait for CSS transitions to complete).
+
+
+
hide.bs.popover
+
This event is fired immediately when the hide instance method has been called.
+
+
+
hidden.bs.popover
+
This event is fired when the popover has finished being hidden from the user (will wait for CSS transitions to complete).
+
+
+
inserted.bs.popover
+
This event is fired after the show.bs.popover event when the popover template has been added to the DOM.
+
+
+
+
$('#myPopover').on('hidden.bs.popover',function(){
+ // do something...
+})
+
Documentation and examples for using Bootstrap custom progress bars featuring support for stacked bars, animated backgrounds, and text labels.
+
+
+
How it works
+
Progress components are built with two HTML elements, some CSS to set the width, and a few attributes. We don’t use the HTML5 <progress> element, ensuring you can stack progress bars, animate them, and place text labels over them.
+
+
We use the .progress as a wrapper to indicate the max value of the progress bar.
+
We use the inner .progress-bar to indicate the progress so far.
+
The .progress-bar requires an inline style, utility class, or custom CSS to set their width.
+
The .progress-bar also requires some role and aria attributes to make it accessible.
+
+
Put that all together, and you have the following examples.
Automatically update Bootstrap navigation or list group components based on scroll position to indicate which link is currently active in the viewport.
+
+
+
How it works
+
Scrollspy has a few requirements to function properly:
+
+
If you’re building our JavaScript from source, it requires util.js.
Scrollspy requires position: relative; on the element you’re spying on, usually the <body>.
+
When spying on elements other than the <body>, be sure to have a height set and overflow-y: scroll; applied.
+
Anchors (<a>) are required and must point to an element with that id.
+
+
When successfully implemented, your nav or list group will update accordingly, moving the .active class from one item to the next based on their associated targets.
+
Example in navbar
+
Scroll the area below the navbar and watch the active class change. The dropdown items will be highlighted as well.
Placeholder content for the scrollspy example. You got the finest architecture. Passport stamps, she's cosmopolitan. Fine, fresh, fierce, we got it on lock. Never planned that one day I'd be losing you. She eats your heart out. Your kiss is cosmic, every move is magic. I mean the ones, I mean like she's the one. Greetings loved ones let's take a journey. Just own the night like the 4th of July! But you'd rather get wasted.
+
@mdo
+
Placeholder content for the scrollspy example. 'Cause she's the muse and the artist. (This is how we do) So you wanna play with magic. So just be sure before you give it all to me. I'm walking, I'm walking on air (tonight). Skip the talk, heard it all, time to walk the walk.
+
one
+
Placeholder content for the scrollspy example. Takes you miles high, so high, 'cause she’s got that one international smile. There's a stranger in my bed, there's a pounding in my head. Oh, no. In another life I would make you stay. ‘Cause I, I’m capable of anything. Suiting up for my crowning battle. Used to steal your parents' liquor and climb to the roof. Tone, tan fit and ready, turn it up cause its gettin' heavy. Her love is like a drug. I guess that I forgot I had a choice.
+
two
+
Placeholder content for the scrollspy example. It's time to bring out the big balloons. I'm walking, I'm walking on air (tonight). Yeah, we maxed our credit cards and got kicked out of the bar. Yo, shout out to all you kids, buying bottle service, with your rent money. I'm ma get your heart racing in my skin-tight jeans. If you get the chance you better keep her. Yo, shout out to all you kids, buying bottle service, with your rent money.
+
three
+
Placeholder content for the scrollspy example. If you wanna dance, if you want it all, you know that I'm the girl that you should call. Walk through the storm I would. So let me get you in your birthday suit. The one that got away. Last Friday night, yeah I think we broke the law, always say we're gonna stop. 'Cause she's a little bit of Yoko, And she's a little bit of 'Oh no'. I want the jaw droppin', eye poppin', head turnin', body shockin'. Yeah, we maxed our credit cards and got kicked out of the bar.
+
And some more placeholder content, for good measure.
Scrollspy also works with nested .navs. If a nested .nav is .active, its parents will also be .active. Scroll the area next to the navbar and watch the active class change.
Placeholder content for the scrollspy example. This one relates to item 1. Takes you miles high, so high, 'cause she’s got that one international smile. There's a stranger in my bed, there's a pounding in my head. Oh, no. In another life I would make you stay. ‘Cause I, I’m capable of anything. Suiting up for my crowning battle. Used to steal your parents' liquor and climb to the roof. Tone, tan fit and ready, turn it up cause its gettin' heavy. Her love is like a drug. I guess that I forgot I had a choice.
+
Item 1-1
+
Placeholder content for the scrollspy example. This one relates to the item 1-1. You got the finest architecture. Passport stamps, she's cosmopolitan. Fine, fresh, fierce, we got it on lock. Never planned that one day I'd be losing you. She eats your heart out. Your kiss is cosmic, every move is magic. I mean the ones, I mean like she's the one. Greetings loved ones let's take a journey. Just own the night like the 4th of July! But you'd rather get wasted.
+
Item 1-2
+
Placeholder content for the scrollspy example. This one relates to the item 1-2. Her love is like a drug. All my girls vintage Chanel baby. Got a motel and built a fort out of sheets. 'Cause she's the muse and the artist. (This is how we do) So you wanna play with magic. So just be sure before you give it all to me. I'm walking, I'm walking on air (tonight). Skip the talk, heard it all, time to walk the walk. Catch her if you can. Stinging like a bee I earned my stripes.
+
Item 2
+
Placeholder content for the scrollspy example. This one relates to item 2. Don't need apologies. There is no fear now, let go and just be free, I will love you unconditionally. Last Friday night. Don't be a shy kinda guy I'll bet it's beautiful. Summer after high school when we first met. 'Cause she's the muse and the artist. What? Wait. No, no, no, no. Thought that I was the exception.
+
Item 3
+
Placeholder content for the scrollspy example. This one relates to item 3. Word on the street, you got somethin' to show me, me. All this money can't buy me a time machine. Make it like your birthday everyday. So we hit the boulevard. You make me feel like I'm livin' a teenage dream, the way you turn me on Skip the talk, heard it all, time to walk the walk. Word on the street, you got somethin' to show me, me. It's no big deal, it's no big deal, it's no big deal.
+
Item 3-1
+
Placeholder content for the scrollspy example. This one relates to item 3-1. Baby do you dare to do this? This is no big deal. Yeah, you're lucky if you're on her plane. Just own the night like the 4th of July! Standing on the frontline when the bombs start to fall. So just be sure before you give it all to me.
+
Item 3-2
+
Placeholder content for the scrollspy example. This one relates to item 3-2. You're original, cannot be replaced. All night they're playing, your song. California girls we're undeniable. Like a bird without a cage. There is no fear now, let go and just be free, I will love you unconditionally. I can see the writing on the wall. You could travel the world but nothing comes close to the golden coast.
Placeholder content for the scrollspy list-group example. This one relates to item 1. Don't need apologies. There is no fear now, let go and just be free, I will love you unconditionally. Last Friday night. Don't be a shy kinda guy I'll bet it's beautiful. Summer after high school when we first met. 'Cause she's the muse and the artist. What? Wait. Thought that I was the exception.
+
Item 2
+
Placeholder content for the scrollspy list-group example. This one relates to item 2. Yeah, she dances to her own beat. Oh, no. You could've been the greatest. 'Cause, baby, you're a firework. Maybe a reason why all the doors are closed. Open up your heart and just let it begin. So très chic, yeah, she's a classic.
+
Item 3
+
Placeholder content for the scrollspy list-group example. This one relates to item 3. We go higher and higher. Never one without the other, we made a pact. I'm walking on air. Someone said you had your tattoo removed. Now I’m floating like a butterfly. Tone, tan fit and ready, turn it up cause its gettin' heavy. Cause once you’re mine, once you’re mine. You just gotta ignite the light and let it shine! So we hit the boulevard. Do you ever feel, feel so paper thin. I see it all, I see it now.
+
Item 4
+
Placeholder content for the scrollspy list-group example. This one relates to item 4. Summer after high school when we first met. There is no fear now, let go and just be free, I will love you unconditionally. Sun-kissed skin so hot we'll melt your popsicle. This love will make you levitate.
To easily add scrollspy behavior to your topbar navigation, add data-spy="scroll" to the element you want to spy on (most typically this would be the <body>). Then add the data-target attribute with the ID or class of the parent element of any Bootstrap .nav component.
After adding position: relative; in your CSS, call the scrollspy via JavaScript:
+
$('body').scrollspy({target:'#navbar-example'})
+
+
Resolvable ID targets required
+
Navbar links must have resolvable id targets. For example, a <a href="#home">home</a> must correspond to something in the DOM like <div id="home"></div>.
+
+
+
+
Non-:visible target elements ignored
+
Target elements that are not :visible according to jQuery will be ignored and their corresponding nav items will never be highlighted.
+
+
+
Methods
+
.scrollspy('refresh')
+
When using scrollspy in conjunction with adding or removing of elements from the DOM, you’ll need to call the refresh method like so:
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.
+
+
+
method
+
string
+
auto
+
Finds which section the spied element is in. auto will choose the best method to get scroll coordinates. offset will use jQuery offset method to get scroll coordinates. position will use jQuery position method to get scroll coordinates.
+
+
+
target
+
string | jQuery object | DOM element
+
+
Specifies element to apply Scrollspy plugin.
+
+
+
+
Events
+
+
+
+
Event Type
+
Description
+
+
+
+
+
activate.bs.scrollspy
+
This event fires on the scroll element whenever a new item becomes activated by the scrollspy.
+
+
+
+
$('[data-spy="scroll"]').on('activate.bs.scrollspy',function(){
+ // do something...
+})
+
Indicate the loading state of a component or page with Bootstrap spinners, built entirely with HTML, CSS, and no JavaScript.
+
+
+
About
+
Bootstrap “spinners” can be used to show the loading state in your projects. They’re built only with HTML and CSS, meaning you don’t need any JavaScript to create them. You will, however, need some custom JavaScript to toggle their visibility. Their appearance, alignment, and sizing can be easily customized with our amazing utility classes.
+
For accessibility purposes, each loader here includes role="status" and a nested <span class="sr-only">Loading...</span>.
The border spinner uses currentColor for its border-color, meaning you can customize the color with text color utilities. You can use any of our text color utilities on the standard spinner.
+Why not use border-color utilities? Each border spinner specifies a transparent border for at least one side, so .border-{color} utilities would override that.
+
+
+
Growing spinner
+
If you don’t fancy a border spinner, switch to the grow spinner. While it doesn’t technically spin, it does repeatedly grow!
Once again, this spinner is built with currentColor, so you can easily change its appearance with text color utilities. Here it is in blue, along with the supported variants.
Spinners in Bootstrap are built with rems, currentColor, and display: inline-flex. This means they can easily be resized, recolored, and quickly aligned.
Use spinners within buttons to indicate an action is currently processing or taking place. You may also swap the text out of the spinner element and utilize button text as needed.
Push notifications to your visitors with a toast, a lightweight and easily customizable alert message.
+
+
+
Toasts are lightweight notifications designed to mimic the push notifications that have been popularized by mobile and desktop operating systems. They’re built with flexbox, so they’re easy to align and position.
+
Overview
+
Things to know when using the toast plugin:
+
+
If you’re building our JavaScript from source, it requires util.js.
+
Toasts are opt-in for performance reasons, so you must initialize them yourself.
+
Please note that you are responsible for positioning toasts.
+
Toasts will automatically hide if you do not specify autohide: false.
To encourage extensible and predictable toasts, we recommend a header and body. Toast headers use display: flex, allowing easy alignment of content thanks to our margin and flexbox utilities.
+
Toasts are as flexible as you need and have very little required markup. At a minimum, we require a single element to contain your “toasted” content and strongly encourage a dismiss button.
+
+
+
+
+
+ Bootstrap
+ 11 mins ago
+
+
+
+ Hello, world! This is a toast message.
+
+
+
<divclass="toast"role="alert"aria-live="assertive"aria-atomic="true">
+ <divclass="toast-header">
+ <imgsrc="..."class="rounded mr-2"alt="...">
+ <strongclass="mr-auto">Bootstrap</strong>
+ <small>11 mins ago</small>
+ <buttontype="button"class="ml-2 mb-1 close"data-dismiss="toast"aria-label="Close">
+ <spanaria-hidden="true">×</span>
+ </button>
+ </div>
+ <divclass="toast-body">
+ Hello, world! This is a toast message.
+ </div>
+</div>
+
Live
+
Click the button the below to show as toast (positioning with our utilities in the lower right corner) that has been hidden by default with .hide.
Toasts are slightly translucent, too, so they blend over whatever they might appear over. For browsers that support the backdrop-filter CSS property, we’ll also attempt to blur the elements under a toast.
+
+
+
+
+
+ Bootstrap
+ 11 mins ago
+
+
+
+ Hello, world! This is a toast message.
+
+
+
<divclass="toast"role="alert"aria-live="assertive"aria-atomic="true">
+ <divclass="toast-header">
+ <imgsrc="..."class="rounded mr-2"alt="...">
+ <strongclass="mr-auto">Bootstrap</strong>
+ <smallclass="text-muted">11 mins ago</small>
+ <buttontype="button"class="ml-2 mb-1 close"data-dismiss="toast"aria-label="Close">
+ <spanaria-hidden="true">×</span>
+ </button>
+ </div>
+ <divclass="toast-body">
+ Hello, world! This is a toast message.
+ </div>
+</div>
+
Stacking
+
When you have multiple toasts, we default to vertically stacking them in a readable manner.
Place toasts with custom CSS as you need them. The top right is often used for notifications, as is the top middle. If you’re only ever going to show one toast at a time, put the positioning styles right on the .toast.
You can also get fancy with flexbox utilities to align toasts horizontally and/or vertically.
+
+
+
+
+
+
+
+
+
+ Bootstrap
+ 11 mins ago
+
+
+
+ Hello, world! This is a toast message.
+
+
+
+
<!-- Flexbox container for aligning the toasts -->
+<divaria-live="polite"aria-atomic="true"class="d-flex justify-content-center align-items-center"style="height: 200px;">
+
+ <!-- Then put toasts within -->
+ <divclass="toast"role="alert"aria-live="assertive"aria-atomic="true">
+ <divclass="toast-header">
+ <imgsrc="..."class="rounded mr-2"alt="...">
+ <strongclass="mr-auto">Bootstrap</strong>
+ <small>11 mins ago</small>
+ <buttontype="button"class="ml-2 mb-1 close"data-dismiss="toast"aria-label="Close">
+ <spanaria-hidden="true">×</span>
+ </button>
+ </div>
+ <divclass="toast-body">
+ Hello, world! This is a toast message.
+ </div>
+ </div>
+</div>
+
Accessibility
+
Toasts are intended to be small interruptions to your visitors or users, so to help those with screen readers and similar assistive technologies, you should wrap your toasts in an aria-live region. Changes to live regions (such as injecting/updating a toast component) are automatically announced by screen readers without needing to move the user’s focus or otherwise interrupt the user. Additionally, include aria-atomic="true" to ensure that the entire toast is always announced as a single (atomic) unit, rather than announcing what was changed (which could lead to problems if you only update part of the toast’s content, or if displaying the same toast content at a later point in time). If the information needed is important for the process, e.g. for a list of errors in a form, then use the alert component instead of toast.
+
Note that the live region needs to be present in the markup before the toast is generated or updated. If you dynamically generate both at the same time and inject them into the page, they will generally not be announced by assistive technologies.
+
You also need to adapt the role and aria-live level depending on the content. If it’s an important message like an error, use role="alert" aria-live="assertive", otherwise use role="status" aria-live="polite" attributes.
+
As the content you’re displaying changes, be sure to update the delay timeout to ensure people have enough time to read the toast.
When using autohide: false, you must add a close button to allow users to dismiss the toast.
+
+
+
+
+
+ Bootstrap
+ 11 mins ago
+
+
+
+ Hello, world! This is a toast message.
+
+
+
<divrole="alert"aria-live="assertive"aria-atomic="true"class="toast"data-autohide="false">
+ <divclass="toast-header">
+ <imgsrc="..."class="rounded mr-2"alt="...">
+ <strongclass="mr-auto">Bootstrap</strong>
+ <small>11 mins ago</small>
+ <buttontype="button"class="ml-2 mb-1 close"data-dismiss="toast"aria-label="Close">
+ <spanaria-hidden="true">×</span>
+ </button>
+ </div>
+ <divclass="toast-body">
+ Hello, world! This is a toast message.
+ </div>
+</div>
+
JavaScript behavior
+
Usage
+
Initialize toasts via JavaScript:
+
$('.toast').toast(option)
+
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 toast
+
+
+
autohide
+
boolean
+
true
+
Auto hide the toast
+
+
+
delay
+
number
+
+ 500
+
+
Delay hiding the toast (ms)
+
+
+
+
Methods
+
+
Asynchronous methods and transitions
+
All API methods are asynchronous and start a transition. They return to the caller as soon as the transition is started but before it ends. In addition, a method call on a transitioning component will be ignored.
Attaches a toast handler to an element collection.
+
.toast('show')
+
Reveals an element’s toast. Returns to the caller before the toast has actually been shown (i.e. before the shown.bs.toast event occurs).
+You have to manually call this method, instead your toast won’t show.
+
$('#element').toast('show')
+
.toast('hide')
+
Hides an element’s toast. Returns to the caller before the toast has actually been hidden (i.e. before the hidden.bs.toast event occurs). You have to manually call this method if you made autohide to false.
+
$('#element').toast('hide')
+
.toast('dispose')
+
Hides an element’s toast. Your toast will remain on the DOM but won’t show anymore.
+
$('#element').toast('dispose')
+
Events
+
+
+
+
Event Type
+
Description
+
+
+
+
+
show.bs.toast
+
This event fires immediately when the show instance method is called.
+
+
+
shown.bs.toast
+
This event is fired when the toast has been made visible to the user.
+
+
+
hide.bs.toast
+
This event is fired immediately when the hide instance method has been called.
+
+
+
hidden.bs.toast
+
This event is fired when the toast has finished being hidden from the user.
+
+
+
+
$('#myToast').on('hidden.bs.toast',function(){
+ // do something...
+})
+
Documentation and examples for adding custom Bootstrap tooltips with CSS and JavaScript using CSS3 for animations and data-attributes for local title storage.
+
+
+
Overview
+
Things to know when using the tooltip plugin:
+
+
Tooltips rely on the 3rd party library Popper for positioning. You must include popper.min.js before bootstrap.js or use bootstrap.bundle.min.js / bootstrap.bundle.js which contains Popper in order for tooltips to work!
+
If you’re building our JavaScript from source, it requires util.js.
+
Tooltips are opt-in for performance reasons, so you must initialize them yourself.
+
Tooltips with zero-length titles are never displayed.
+
Specify container: 'body' to avoid rendering problems in more complex components (like our input groups, button groups, etc).
+
Triggering tooltips on hidden elements will not work.
+
Tooltips for .disabled or disabled elements must be triggered on a wrapper element.
+
When triggered from hyperlinks that span multiple lines, tooltips will be centered. Use white-space: nowrap; on your <a>s to avoid this behavior.
+
Tooltips must be hidden before their corresponding elements have been removed from the DOM.
+
Tooltips can be triggered thanks to an element inside a shadow DOM.
Placeholder text to demonstrate some inline links with tooltips. This is now just filler, no killer. Content placed here just to mimic the presence of real text. And all that just to give you an idea of how tooltips would look when used in real-world situations. So hopefully you've now seen how these tooltips on links can work in practice, once you use them on your own site or project.
+
+
+
Hover over the buttons below to see the four tooltips directions: top, right, bottom, and left.
+
+
+
+
+
+
+
+
+
+
<buttontype="button"class="btn btn-secondary"data-toggle="tooltip"data-placement="top"title="Tooltip on top">
+ Tooltip on top
+</button>
+<buttontype="button"class="btn btn-secondary"data-toggle="tooltip"data-placement="right"title="Tooltip on right">
+ Tooltip on right
+</button>
+<buttontype="button"class="btn btn-secondary"data-toggle="tooltip"data-placement="bottom"title="Tooltip on bottom">
+ Tooltip on bottom
+</button>
+<buttontype="button"class="btn btn-secondary"data-toggle="tooltip"data-placement="left"title="Tooltip on left">
+ Tooltip on left
+</button>
+
And with custom HTML added:
+
<buttontype="button"class="btn btn-secondary"data-toggle="tooltip"data-html="true"title="<em>Tooltip</em> <u>with</u> <b>HTML</b>">
+ Tooltip with HTML
+</button>
+
Usage
+
The tooltip plugin generates content and markup on demand, and by default places tooltips after their trigger element.
+
Trigger the tooltip via JavaScript:
+
$('#example').tooltip(options)
+
+
Overflow auto and scroll
+
Tooltip position attempts to automatically change when a parent container has overflow: auto or overflow: scroll like our .table-responsive, but still keeps the original placement’s positioning. To resolve, set the boundary option to anything other than default value, 'scrollParent', such as 'window':
+
$('#example').tooltip({boundary:'window'})
+
+
+
+
Markup
+
The required markup for a tooltip is only a data attribute and title on the HTML element you wish to have a tooltip. The generated markup of a tooltip is rather simple, though it does require a position (by default, set to top by the plugin).
+
+
Making tooltips work for keyboard and assistive technology users
+
You should only add tooltips to HTML elements that are traditionally keyboard-focusable and interactive (such as links or form controls). Although arbitrary HTML elements (such as <span>s) can be made focusable by adding the tabindex="0" attribute, this will add potentially annoying and confusing tab stops on non-interactive elements for keyboard users, and most assistive technologies currently do not announce the tooltip in this situation. Additionally, do not rely solely on hover as the trigger for your tooltip, as this will make your tooltips impossible to trigger for keyboard users.
+
+
+
<!-- HTML to write -->
+<ahref="#"data-toggle="tooltip"title="Some tooltip text!">Hover over me</a>
+
+<!-- Generated markup by the plugin -->
+<divclass="tooltip bs-tooltip-top"role="tooltip">
+ <divclass="arrow"></div>
+ <divclass="tooltip-inner">
+ Some tooltip text!
+ </div>
+</div>
+
Disabled elements
+
Elements with the disabled attribute aren’t interactive, meaning users cannot focus, hover, or click them to trigger a tooltip (or popover). As a workaround, you’ll want to trigger the tooltip from a wrapper <div> or <span>, ideally made keyboard-focusable using tabindex="0", and override the pointer-events on the disabled element.
Options can be passed via data attributes or JavaScript. For data attributes, append the option name to data-, as in data-animation="".
+
+Note that for security reasons the sanitize, sanitizeFn and whiteList options cannot be supplied using data attributes.
+
+
+
+
+
+
Name
+
Type
+
Default
+
Description
+
+
+
+
+
animation
+
boolean
+
true
+
Apply a CSS fade transition to the tooltip
+
+
+
container
+
string | element | false
+
false
+
+
Appends the tooltip to a specific element. Example: container: 'body'. This option is particularly useful in that it allows you to position the tooltip in the flow of the document near the triggering element - which will prevent the tooltip from floating away from the triggering element during a window resize.
+
+
+
+
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: delay: { "show": 500, "hide": 100 }
+
+
+
+
html
+
boolean
+
false
+
+
Allow HTML in the tooltip.
+
If true, HTML tags in the tooltip's title will be rendered in 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 - auto | top | bottom | left | right. When auto is specified, it will dynamically reorient the tooltip.
+
When a function is used to determine the placement, it is called with the tooltip DOM node as its first argument and the triggering element DOM node as its second. The this context is set to the tooltip instance.
+
+
+
+
selector
+
string | false
+
false
+
If a selector is provided, tooltip objects will be delegated to the specified targets. In practice, this is used to also apply tooltips to dynamically added DOM elements (jQuery.on support). See this and an informative example.
The tooltip's title will be injected into the .tooltip-inner.
+
.arrow will become the tooltip's arrow.
+
The outermost wrapper element should have the .tooltip class and role="tooltip".
+
+
+
+
title
+
string | element | function
+
''
+
+
Default title value if title attribute isn't present.
+
If a function is given, it will be called with its this reference set to the element that the tooltip is attached to.
+
+
+
+
trigger
+
string
+
'hover focus'
+
+
How tooltip is triggered - click | hover | focus | manual. You may pass multiple triggers; separate them with a space.
+
'manual' indicates that the tooltip will be triggered programmatically via the .tooltip('show'), .tooltip('hide') and .tooltip('toggle') methods; this value cannot be combined with any other trigger.
+
'hover' on its own will result in tooltips that cannot be triggered via the keyboard, and should only be used if alternative methods for conveying the same information for keyboard users is present.
+
+
+
+
offset
+
number | string | function
+
0
+
+
Offset of the tooltip relative to its target.
+
When a function is used to determine the offset, it is called with an object containing the offset data as its first argument. The function must return an object with the same structure. The triggering element DOM node is passed as the second argument.
+
For more information refer to Popper's offset docs.
+
+
+
+
fallbackPlacement
+
string | array
+
'flip'
+
Allow to specify which position Popper will use on fallback. For more information refer to
+ Popper's behavior docs
+
+
+
customClass
+
string | function
+
''
+
+
Add classes to the tooltip when it is shown. Note that these classes will be added in addition to any classes specified in the template. To add multiple classes, separate them with spaces: 'a b'.
+
You can also pass a function that should return a single string containing additional class names.
+
+
+
+
boundary
+
string | element
+
'scrollParent'
+
Overflow constraint boundary of the tooltip. Accepts the values of 'viewport', 'window', 'scrollParent', or an HTMLElement reference (JavaScript only). For more information refer to Popper's preventOverflow docs.
+
+
+
sanitize
+
boolean
+
true
+
Enable or disable the sanitization. If activated 'template' and 'title' options will be sanitized.
Options for individual tooltips can alternatively be specified through the use of data attributes, as explained above.
+
+
+
Methods
+
+
Asynchronous methods and transitions
+
All API methods are asynchronous and start a transition. They return to the caller as soon as the transition is started but before it ends. In addition, a method call on a transitioning component will be ignored.
Attaches a tooltip handler to an element collection.
+
.tooltip('show')
+
Reveals an element’s tooltip. Returns to the caller before the tooltip has actually been shown (i.e. before the shown.bs.tooltip event occurs). This is considered a “manual” triggering of the tooltip. Tooltips with zero-length titles are never displayed.
+
$('#element').tooltip('show')
+
.tooltip('hide')
+
Hides an element’s tooltip. Returns to the caller before the tooltip has actually been hidden (i.e. before the hidden.bs.tooltip event occurs). This is considered a “manual” triggering of the tooltip.
+
$('#element').tooltip('hide')
+
.tooltip('toggle')
+
Toggles an element’s tooltip. Returns to the caller before the tooltip has actually been shown or hidden (i.e. before the shown.bs.tooltip or hidden.bs.tooltip event occurs). This is considered a “manual” triggering of the tooltip.
+
$('#element').tooltip('toggle')
+
.tooltip('dispose')
+
Hides and destroys an element’s tooltip. Tooltips that use delegation (which are created using the selector option) cannot be individually destroyed on descendant trigger elements.
+
$('#element').tooltip('dispose')
+
.tooltip('enable')
+
Gives an element’s tooltip the ability to be shown. Tooltips are enabled by default.
+
$('#element').tooltip('enable')
+
.tooltip('disable')
+
Removes the ability for an element’s tooltip to be shown. The tooltip will only be able to be shown if it is re-enabled.
+
$('#element').tooltip('disable')
+
.tooltip('toggleEnabled')
+
Toggles the ability for an element’s tooltip to be shown or hidden.
+
$('#element').tooltip('toggleEnabled')
+
.tooltip('update')
+
Updates the position of an element’s tooltip.
+
$('#element').tooltip('update')
+
Events
+
+
+
+
Event Type
+
Description
+
+
+
+
+
show.bs.tooltip
+
This event fires immediately when the show instance method is called.
+
+
+
shown.bs.tooltip
+
This event is fired when the tooltip has been made visible to the user (will wait for CSS transitions to complete).
+
+
+
hide.bs.tooltip
+
This event is fired immediately when the hide instance method has been called.
+
+
+
hidden.bs.tooltip
+
This event is fired when the tooltip has finished being hidden from the user (will wait for CSS transitions to complete).
+
+
+
inserted.bs.tooltip
+
This event is fired after the show.bs.tooltip event when the tooltip template has been added to the DOM.
+
+
+
+
$('#myTooltip').on('hidden.bs.tooltip',function(){
+ // do something...
+})
+
Documentation and examples for displaying inline and multiline blocks of code with Bootstrap.
+
+
+
Inline code
+
Wrap inline snippets of code with <code>. Be sure to escape HTML angle brackets.
+
+For example, <section> should be wrapped as inline.
+
For example, <code><section></code> should be wrapped as inline.
+
Code blocks
+
Use <pre>s for multiple lines of code. Once again, be sure to escape any angle brackets in the code for proper rendering. You may optionally add the .pre-scrollable class, which will set a max-height of 340px and provide a y-axis scrollbar.
+
+
<p>Sample text here...</p>
+<p>And another line of sample text here...</p>
+
+
<pre><code><p>Sample text here...</p>
+<p>And another line of sample text here...</p>
+</code></pre>
Use the <kbd> to indicate input that is typically entered via keyboard.
+
+To switch directories, type cd followed by the name of the directory.
+To edit settings, press ctrl + ,
+
To switch directories, type <kbd>cd</kbd> followed by the name of the directory.<br>
+To edit settings, press <kbd><kbd>ctrl</kbd> + <kbd>,</kbd></kbd>
+
Sample output
+
For indicating sample output from a program use the <samp> tag.
+
+This text is meant to be treated as sample output from a computer program.
+
<samp>This text is meant to be treated as sample output from a computer program.</samp>
Documentation and examples for displaying related images and text with the figure component in Bootstrap.
+
+
+
Anytime you need to display a piece of content—like an image with an optional caption, consider using a <figure>.
+
Use the included .figure , .figure-img and .figure-caption classes to provide some baseline styles for the HTML5 <figure> and <figcaption> elements. Images in figures have no explicit size, so be sure to add the .img-fluid class to your <img> to make it responsive.
+
+
+
+
+ A caption for the above image.
+
+
<figureclass="figure">
+ <imgsrc="..."class="figure-img img-fluid rounded"alt="...">
+ <figcaptionclass="figure-caption">A caption for the above image.</figcaption>
+</figure>
+
Aligning the figure’s caption is easy with our text utilities.
+
+
+
+
+ A caption for the above image.
+
+
<figureclass="figure">
+ <imgsrc="..."class="figure-img img-fluid rounded"alt="...">
+ <figcaptionclass="figure-caption text-right">A caption for the above image.</figcaption>
+</figure>
Documentation and examples for opting images into responsive behavior (so they never become larger than their parent elements) and add lightweight styles to them—all via classes.
+
+
+
Responsive images
+
Images in Bootstrap are made responsive with .img-fluid. max-width: 100%; and height: auto; are applied to the image so that it scales with the parent element.
+
+
+
+
<imgsrc="..."class="img-fluid"alt="...">
+
+
SVG images and Internet Explorer
+
In Internet Explorer 10 and 11, SVG images with .img-fluid are disproportionately sized. To fix this, add width: 100%; or .w-100 where necessary. This fix improperly sizes other image formats, so Bootstrap doesn’t apply it automatically.
+
+
+
Image thumbnails
+
In addition to our border-radius utilities, you can use .img-thumbnail to give an image a rounded 1px border appearance.
If you are using the <picture> element to specify multiple <source> elements for a specific <img>, make sure to add the .img-* classes to the <img> and not to the <picture> tag.
Reboot, a collection of element-specific CSS changes in a single file, kickstart Bootstrap to provide an elegant, consistent, and simple baseline to build upon.
+
+
+
Approach
+
Reboot builds upon Normalize, providing many HTML elements with somewhat opinionated styles using only element selectors. Additional styling is done only with classes. For example, we reboot some <table> styles for a simpler baseline and later provide .table, .table-bordered, and more.
+
Here are our guidelines and reasons for choosing what to override in Reboot:
+
+
Update some browser default values to use rems instead of ems for scalable component spacing.
+
Avoid margin-top. Vertical margins can collapse, yielding unexpected results. More importantly though, a single direction of margin is a simpler mental model.
+
For easier scaling across device sizes, block elements should use rems for margins.
+
Keep declarations of font-related properties to a minimum, using inherit whenever possible.
+
+
Page defaults
+
The <html> and <body> elements are updated to provide better page-wide defaults. More specifically:
+
+
The box-sizing is globally set on every element—including *::before and *::after, to border-box. This ensures that the declared width of element is never exceeded due to padding or border.
+
No base font-size is declared on the <html>, but 16px is assumed (the browser default). font-size: 1rem is applied on the <body> for easy responsive type-scaling via media queries while respecting user preferences and ensuring a more accessible approach.
+
The <body> also sets a global font-family, line-height, and text-align. This is inherited later by some form elements to prevent font inconsistencies.
+
For safety, the <body> has a declared background-color, defaulting to #fff.
+
+
Native font stack
+
The default web fonts (Helvetica Neue, Helvetica, and Arial) have been dropped in Bootstrap 4 and replaced with a “native font stack” for optimum text rendering on every device and OS. Read more about native font stacks in this Smashing Magazine article.
+
$font-family-sans-serif:
+ // Safari for macOS and iOS (San Francisco)
+ -apple-system,
+ // Chrome < 56 for macOS (San Francisco)
+ BlinkMacSystemFont,
+ // Windows
+ "Segoe UI",
+ // Android
+ Roboto,
+ // Basic web fallback
+ "Helvetica Neue",Arial,
+ // Linux
+ "Noto Sans",
+ "Liberation Sans",
+ // Sans serif fallback
+ sans-serif,
+ // Emoji fonts
+ "Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji"!default;
+
Note that because the font stack includes emoji fonts, many common symbol/dingbat unicode characters will be rendered as multi-colored pictographs. Their appearance will vary, depending on the style used in the browser/platform’s native emoji font, and they won’t be affected by any CSS color styles.
+
This font-family is applied to the <body> and automatically inherited globally throughout Bootstrap. To switch the global font-family, update $font-family-base and recompile Bootstrap.
+
Headings and paragraphs
+
All heading elements—e.g., <h1>—and <p> are reset to have their margin-top removed. Headings have margin-bottom: .5rem added and paragraphs margin-bottom: 1rem for easy spacing.
+
+
+
+
Heading
+
Example
+
+
+
+
+
+ <h1></h1>
+
+
h1. Bootstrap heading
+
+
+
+ <h2></h2>
+
+
h2. Bootstrap heading
+
+
+
+ <h3></h3>
+
+
h3. Bootstrap heading
+
+
+
+ <h4></h4>
+
+
h4. Bootstrap heading
+
+
+
+ <h5></h5>
+
+
h5. Bootstrap heading
+
+
+
+ <h6></h6>
+
+
h6. Bootstrap heading
+
+
+
+
Lists
+
All lists—<ul>, <ol>, and <dl>—have their margin-top removed and a margin-bottom: 1rem. Nested lists have no margin-bottom.
+
+
+
All lists have their top margin removed
+
And their bottom margin normalized
+
Nested lists have no bottom margin
+
+
This way they have a more even appearance
+
Particularly when followed by more list items
+
+
+
The left padding has also been reset
+
+
+
Here’s an ordered list
+
With a few list items
+
It has the same overall look
+
As the previous unordered list
+
+
+
+
For simpler styling, clear hierarchy, and better spacing, description lists have updated margins. <dd>s reset margin-left to 0 and add margin-bottom: .5rem. <dt>s are bolded.
+
+
+
Description lists
+
A description list is perfect for defining terms.
+
Term
+
Definition for the term.
+
A second definition for the same term.
+
Another term
+
Definition for this other term.
+
+
+
Preformatted text
+
The <pre> element is reset to remove its margin-top and use rem units for its margin-bottom.
+
+
+.example-element {
+ margin-bottom: 1rem;
+}
+
+
+
Tables
+
Tables are slightly adjusted to style <caption>s, collapse borders, and ensure consistent text-align throughout. Additional changes for borders, padding, and more come with the .table class.
+
+
+
+ This is an example table, and this is its caption to describe the contents.
+
+
+
+
Table heading
+
Table heading
+
Table heading
+
Table heading
+
+
+
+
+
Table cell
+
Table cell
+
Table cell
+
Table cell
+
+
+
Table cell
+
Table cell
+
Table cell
+
Table cell
+
+
+
Table cell
+
Table cell
+
Table cell
+
Table cell
+
+
+
+
+
Forms
+
Various form elements have been rebooted for simpler base styles. Here are some of the most notable changes:
+
+
<fieldset>s have no borders, padding, or margin so they can be easily used as wrappers for individual inputs or groups of inputs.
+
<legend>s, like fieldsets, have also been restyled to be displayed as a heading of sorts.
+
<label>s are set to display: inline-block to allow margin to be applied.
+
<input>s, <select>s, <textarea>s, and <button>s are mostly addressed by Normalize, but Reboot removes their margin and sets line-height: inherit, too.
+
<textarea>s are modified to only be resizable vertically as horizontal resizing often “breaks” page layout.
+
<button>s and <input> button elements have cursor: pointer when :not(:disabled).
+
+
These changes, and more, are demonstrated below.
+
+
Pointers on buttons
+
Reboot includes an enhancement for role="button" to change the default cursor to pointer. Add this attribute to elements to help indicate elements are interactive. This role isn’t necessary for <button> elements, which get their own cursor change.
+
+Non-button element button
+
<spanrole="button"tabindex="0">Non-button element button</span>
+
Misc elements
+
Address
+
The <address> element is updated to reset the browser default font-style from italic to normal. line-height is also now inherited, and margin-bottom: 1rem has been added. <address>s are for presenting contact information for the nearest ancestor (or an entire body of work). Preserve formatting by ending lines with <br>.
+
+
+ Twitter, Inc.
+ 1355 Market St, Suite 900
+ San Francisco, CA 94103
+ P: (123) 456-7890
+
+
+ Full Name
+ first.last@example.com
+
+
+
Blockquote
+
The default margin on blockquotes is 1em 40px, so we reset that to 0 0 1rem for something more consistent with other elements.
+
+
+
A well-known quote, contained in a blockquote element.
+
+
+
+
Inline elements
+
The <abbr> element receives basic styling to make it stand out amongst paragraph text.
+
+ Nulla attr vitae elit libero, a pharetra augue.
+
+
Summary
+
The default cursor on summary is text, so we reset that to pointer to convey that the element can be interacted with by clicking on it.
+
+
+ Some details
+
More info about the details.
+
+
+ Even more details
+
Here are even more details about the details.
+
+
+
HTML5 [hidden] attribute
+
HTML5 adds a new global attribute named [hidden], which is styled as display: none by default. Borrowing an idea from PureCSS, we improve upon this default by making [hidden] { display: none !important; } to help prevent its display from getting accidentally overridden. While [hidden] isn’t natively supported by IE10, the explicit declaration in our CSS gets around that problem.
+
<inputtype="text"hidden>
+
+
jQuery incompatibility
+
[hidden] is not compatible with jQuery’s $(...).hide() and $(...).show() methods. Therefore, we don’t currently especially endorse [hidden] over other techniques for managing the display of elements.
+
+
+
To merely toggle the visibility of an element, meaning its display is not modified and the element can still affect the flow of the document, use the .invisible class instead.
Documentation and examples for opt-in styling of tables (given their prevalent use in JavaScript plugins) with Bootstrap.
+
+
+
Examples
+
Due to the widespread use of tables across third-party widgets like calendars and date pickers, we’ve designed our tables to be opt-in. Just add the base class .table to any <table>, then extend with custom styles or our various included modifier classes.
+
Using the most basic table markup, here’s how .table-based tables look in Bootstrap. All table styles are inherited in Bootstrap 4, meaning any nested tables will be styled in the same manner as the parent.
Regular table background variants are not available with the dark table, however, you may use text or background utilities to achieve similar styles.
+
+
+
+
+
#
+
Heading
+
Heading
+
+
+
+
+
1
+
Cell
+
Cell
+
+
+
2
+
Cell
+
Cell
+
+
+
3
+
Cell
+
Cell
+
+
+
4
+
Cell
+
Cell
+
+
+
5
+
Cell
+
Cell
+
+
+
6
+
Cell
+
Cell
+
+
+
7
+
Cell
+
Cell
+
+
+
8
+
Cell
+
Cell
+
+
+
9
+
Cell
+
Cell
+
+
+
+
+
<!-- On rows -->
+<trclass="bg-primary">...</tr>
+<trclass="bg-success">...</tr>
+<trclass="bg-warning">...</tr>
+<trclass="bg-danger">...</tr>
+<trclass="bg-info">...</tr>
+
+<!-- On cells (`td` or `th`) -->
+<tr>
+ <tdclass="bg-primary">...</td>
+ <tdclass="bg-success">...</td>
+ <tdclass="bg-warning">...</td>
+ <tdclass="bg-danger">...</td>
+ <tdclass="bg-info">...</td>
+</tr>
+
+
Conveying meaning to assistive technologies
+
Using color to add meaning only provides a visual indication, which will not be conveyed to users of assistive technologies – such as screen readers. Ensure that information denoted by the color is either obvious from the content itself (e.g. the visible text), or is included through alternative means, such as additional text hidden with the .sr-only class.
+
+
+
Create responsive tables by wrapping any .table with .table-responsive{-sm|-md|-lg|-xl}, making the table scroll horizontally at each max-width breakpoint of up to (but not including) 576px, 768px, 992px, and 1120px, respectively.
+
+Note that since browsers do not currently support range context queries, we work around the limitations of min- and max- prefixes and viewports with fractional widths (which can occur under certain conditions on high-dpi devices, for instance) by using values with higher precision for these comparisons.
+
+
+
Captions
+
A <caption> functions like a heading for a table. It helps users with screen readers to find a table and understand what it’s about and decide if they want to read it.
Responsive tables allow tables to be scrolled horizontally with ease. Make any table responsive across all viewports by wrapping a .table with .table-responsive. Or, pick a maximum breakpoint with which to have a responsive table up to by using .table-responsive{-sm|-md|-lg|-xl}.
+
+
Vertical clipping/truncation
+
Responsive tables make use of overflow-y: hidden, which clips off any content that goes beyond the bottom or top edges of the table. In particular, this can clip off dropdown menus and other third-party widgets.
+
+
+
Always responsive
+
Across every breakpoint, use .table-responsive for horizontally scrolling tables.
Use .table-responsive{-sm|-md|-lg|-xl} as needed to create responsive tables up to a particular breakpoint. From that breakpoint and up, the table will behave normally and not scroll horizontally.
+
These tables may appear broken until their responsive styles apply at specific viewport widths.
Documentation and examples for Bootstrap typography, including global settings, headings, body text, lists, and more.
+
+
+
Global settings
+
Bootstrap sets basic global display, typography, and link styles. When more control is needed, check out the textual utility classes.
+
+
Use a native font stack that selects the best font-family for each OS and device.
+
For a more inclusive and accessible type scale, we use the browser’s default root font-size (typically 16px) so visitors can customize their browser defaults as needed.
+
Use the $font-family-base, $font-size-base, and $line-height-base attributes as our typographic base applied to the <body>.
+
Set the global link color via $link-color and apply link underlines only on :hover.
+
Use $body-bg to set a background-color on the <body> (#fff by default).
+
+
These styles can be found within _reboot.scss, and the global variables are defined in _variables.scss. Make sure to set $font-size-base in rem.
+
Headings
+
All HTML headings, <h1> through <h6>, are available.
Traditional heading elements are designed to work best in the meat of your page content. When you need a heading to stand out, consider using a display heading—a larger, slightly more opinionated heading style. Keep in mind these headings are not responsive by default, but it’s possible to enable responsive font sizes.
+ This is a lead paragraph. It stands out from regular paragraphs.
+
+
<pclass="lead">
+ This is a lead paragraph. It stands out from regular paragraphs.
+</p>
+
Inline text elements
+
Styling for common inline HTML5 elements.
+
+
You can use the mark tag to highlight text.
+
This line of text is meant to be treated as deleted text.
+
This line of text is meant to be treated as no longer accurate.
+
This line of text is meant to be treated as an addition to the document.
+
This line of text will render as underlined
+
This line of text is meant to be treated as fine print.
+
This line rendered as bold text.
+
This line rendered as italicized text.
+
<p>You can use the mark tag to <mark>highlight</mark> text.</p>
+<p><del>This line of text is meant to be treated as deleted text.</del></p>
+<p><s>This line of text is meant to be treated as no longer accurate.</s></p>
+<p><ins>This line of text is meant to be treated as an addition to the document.</ins></p>
+<p><u>This line of text will render as underlined</u></p>
+<p><small>This line of text is meant to be treated as fine print.</small></p>
+<p><strong>This line rendered as bold text.</strong></p>
+<p><em>This line rendered as italicized text.</em></p>
+
.mark and .small classes are also available to apply the same styles as <mark> and <small> while avoiding any unwanted semantic implications that the tags would bring.
+
While not shown above, 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.
Stylized implementation of HTML’s <abbr> element for abbreviations and acronyms to show the expanded version on hover. Abbreviations have a default underline and gain a help cursor to provide additional context on hover and to users of assistive technologies.
+
Add .initialism to an abbreviation for a slightly smaller font-size.
For quoting blocks of content from another source within your document. Wrap <blockquote class="blockquote"> around any HTML as the quote.
+
+
+
A well-known quote, contained in a blockquote element.
+
+
<blockquoteclass="blockquote">
+ <pclass="mb-0">A well-known quote, contained in a blockquote element.</p>
+</blockquote>
+
Naming a source
+
Add a <footer class="blockquote-footer"> for identifying the source. Wrap the name of the source work in <cite>.
+
+
+
A well-known quote, contained in a blockquote element.
+
+
+
<blockquoteclass="blockquote">
+ <pclass="mb-0">A well-known quote, contained in a blockquote element.</p>
+ <footerclass="blockquote-footer">Someone famous in <citetitle="Source Title">Source Title</cite></footer>
+</blockquote>
+
Alignment
+
Use text utilities as needed to change the alignment of your blockquote.
+
+
+
>A well-known quote, contained in a blockquote element.
+
+
+
<blockquoteclass="blockquote text-center">
+ <pclass="mb-0">>A well-known quote, contained in a blockquote element.</p>
+ <footerclass="blockquote-footer">Someone famous in <citetitle="Source Title">Source Title</cite></footer>
+</blockquote>
+
+
+
A well-known quote, contained in a blockquote element.
+
+
+
<blockquoteclass="blockquote text-right">
+ <pclass="mb-0">A well-known quote, contained in a blockquote element.</p>
+ <footerclass="blockquote-footer">Someone famous in <citetitle="Source Title">Source Title</cite></footer>
+</blockquote>
+
Lists
+
Unstyled
+
Remove the default list-style and left margin on list items (immediate children only). This only applies to immediate children list items, meaning you will need to add the class for any nested lists as well.
+
+
+
This is a list.
+
It appears completely unstyled.
+
Structurally, it's still a list.
+
However, this style only applies to immediate child elements.
+
Nested lists:
+
+
are unaffected by this style
+
will still show a bullet
+
and have appropriate left margin
+
+
+
This may still come in handy in some situations.
+
+
<ulclass="list-unstyled">
+ <li>This is a list.</li>
+ <li>It appears completely unstyled.</li>
+ <li>Structurally, it's still a list.</li>
+ <li>However, this style only applies to immediate child elements.</li>
+ <li>Nested lists:
+ <ul>
+ <li>are unaffected by this style</li>
+ <li>will still show a bullet</li>
+ <li>and have appropriate left margin</li>
+ </ul>
+ </li>
+ <li>This may still come in handy in some situations.</li>
+</ul>
+
Inline
+
Remove a list’s bullets and apply some light margin with a combination of two classes, .list-inline and .list-inline-item.
+
+
+
This is a list item.
+
And another one.
+
But they're displayed inline.
+
+
<ulclass="list-inline">
+ <liclass="list-inline-item">This is a list item.</li>
+ <liclass="list-inline-item">And another one.</li>
+ <liclass="list-inline-item">But they're displayed inline.</li>
+</ul>
+
Description list alignment
+
Align terms and descriptions horizontally by using our grid system’s predefined classes (or semantic mixins). For longer terms, you can optionally add a .text-truncate class to truncate the text with an ellipsis.
+
+
+
Description lists
+
A description list is perfect for defining terms.
+
+
Term
+
+
Definition for the term.
+
And some more placeholder definition text.
+
+
+
Another term
+
This definition is short, so no extra paragraphs or anything.
+
+
Truncated term is truncated
+
This can be useful when space is tight. Adds an ellipsis at the end.
+
+
Nesting
+
+
+
Nested definition list
+
I heard you like definition lists. Let me put a definition list inside your definition list.
+
+
+
+
<dlclass="row">
+ <dtclass="col-sm-3">Description lists</dt>
+ <ddclass="col-sm-9">A description list is perfect for defining terms.</dd>
+
+ <dtclass="col-sm-3">Term</dt>
+ <ddclass="col-sm-9">
+ <p>Definition for the term.</p>
+ <p>And some more placeholder definition text.</p>
+ </dd>
+
+ <dtclass="col-sm-3">Another term</dt>
+ <ddclass="col-sm-9">This definition is short, so no extra paragraphs or anything.</dd>
+
+ <dtclass="col-sm-3 text-truncate">Truncated term is truncated</dt>
+ <ddclass="col-sm-9">This can be useful when space is tight. Adds an ellipsis at the end.</dd>
+
+ <dtclass="col-sm-3">Nesting</dt>
+ <ddclass="col-sm-9">
+ <dlclass="row">
+ <dtclass="col-sm-4">Nested definition list</dt>
+ <ddclass="col-sm-8">I heard you like definition lists. Let me put a definition list inside your definition list.</dd>
+ </dl>
+ </dd>
+</dl>
+
Responsive font sizes
+
As of v4.3.0, Bootstrap ships with the option to enable responsive font sizes, allowing text to scale more naturally across device and viewport sizes. RFS can be enabled by changing the $enable-responsive-font-sizes Sass variable to true and recompiling Bootstrap.
+
To support RFS, we use a Sass mixin to replace our normal font-size properties. Responsive font sizes will be compiled into calc() functions with a mix of rem and viewport units to enable the responsive scaling behavior. More about RFS and its configuration can be found on its GitHub repository.
` elements.\n\nbody {\n margin: 0; // 1\n font-family: $font-family-base;\n @include font-size($font-size-base);\n font-weight: $font-weight-base;\n line-height: $line-height-base;\n color: $body-color;\n text-align: left; // 3\n background-color: $body-bg; // 2\n}\n\n// Future-proof rule: in browsers that support :focus-visible, suppress the focus outline\n// on elements that programmatically receive focus but wouldn't normally show a visible\n// focus outline. In general, this would mean that the outline is only applied if the\n// interaction that led to the element receiving programmatic focus was a keyboard interaction,\n// or the browser has somehow determined that the user is primarily a keyboard user and/or\n// wants focus outlines to always be presented.\n//\n// See https://developer.mozilla.org/en-US/docs/Web/CSS/:focus-visible\n// and https://developer.paciellogroup.com/blog/2018/03/focus-visible-and-backwards-compatibility/\n[tabindex=\"-1\"]:focus:not(:focus-visible) {\n outline: 0 !important;\n}\n\n\n// Content grouping\n//\n// 1. Add the correct box sizing in Firefox.\n// 2. Show the overflow in Edge and IE.\n\nhr {\n box-sizing: content-box; // 1\n height: 0; // 1\n overflow: visible; // 2\n}\n\n\n//\n// Typography\n//\n\n// Remove top margins from headings\n//\n// By default, `
`-`
` all receive top and bottom margins. We nuke the top\n// margin for easier control within type scales as it avoids margin collapsing.\n// stylelint-disable-next-line selector-list-comma-newline-after\nh1, h2, h3, h4, h5, h6 {\n margin-top: 0;\n margin-bottom: $headings-margin-bottom;\n}\n\n// Reset margins on paragraphs\n//\n// Similarly, the top margin on `
`s get reset. However, we also reset the\n// bottom margin to use `rem` units instead of `em`.\np {\n margin-top: 0;\n margin-bottom: $paragraph-margin-bottom;\n}\n\n// Abbreviations\n//\n// 1. Duplicate behavior to the data-* attribute for our tooltip plugin\n// 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.\n// 3. Add explicit cursor to indicate changed behavior.\n// 4. Remove the bottom border in Firefox 39-.\n// 5. Prevent the text-decoration to be skipped.\n\nabbr[title],\nabbr[data-original-title] { // 1\n text-decoration: underline; // 2\n text-decoration: underline dotted; // 2\n cursor: help; // 3\n border-bottom: 0; // 4\n text-decoration-skip-ink: none; // 5\n}\n\naddress {\n margin-bottom: 1rem;\n font-style: normal;\n line-height: inherit;\n}\n\nol,\nul,\ndl {\n margin-top: 0;\n margin-bottom: 1rem;\n}\n\nol ol,\nul ul,\nol ul,\nul ol {\n margin-bottom: 0;\n}\n\ndt {\n font-weight: $dt-font-weight;\n}\n\ndd {\n margin-bottom: .5rem;\n margin-left: 0; // Undo browser default\n}\n\nblockquote {\n margin: 0 0 1rem;\n}\n\nb,\nstrong {\n font-weight: $font-weight-bolder; // Add the correct font weight in Chrome, Edge, and Safari\n}\n\nsmall {\n @include font-size(80%); // Add the correct font size in all browsers\n}\n\n//\n// Prevent `sub` and `sup` elements from affecting the line height in\n// all browsers.\n//\n\nsub,\nsup {\n position: relative;\n @include font-size(75%);\n line-height: 0;\n vertical-align: baseline;\n}\n\nsub { bottom: -.25em; }\nsup { top: -.5em; }\n\n\n//\n// Links\n//\n\na {\n color: $link-color;\n text-decoration: $link-decoration;\n background-color: transparent; // Remove the gray background on active links in IE 10.\n\n @include hover() {\n color: $link-hover-color;\n text-decoration: $link-hover-decoration;\n }\n}\n\n// And undo these styles for placeholder links/named anchors (without href).\n// It would be more straightforward to just use a[href] in previous block, but that\n// causes specificity issues in many other styles that are too complex to fix.\n// See https://github.com/twbs/bootstrap/issues/19402\n\na:not([href]):not([class]) {\n color: inherit;\n text-decoration: none;\n\n @include hover() {\n color: inherit;\n text-decoration: none;\n }\n}\n\n\n//\n// Code\n//\n\npre,\ncode,\nkbd,\nsamp {\n font-family: $font-family-monospace;\n @include font-size(1em); // Correct the odd `em` font sizing in all browsers.\n}\n\npre {\n // Remove browser default top margin\n margin-top: 0;\n // Reset browser default of `1em` to use `rem`s\n margin-bottom: 1rem;\n // Don't allow content to break outside\n overflow: auto;\n // Disable auto-hiding scrollbar in IE & legacy Edge to avoid overlap,\n // making it impossible to interact with the content\n -ms-overflow-style: scrollbar;\n}\n\n\n//\n// Figures\n//\n\nfigure {\n // Apply a consistent margin strategy (matches our type styles).\n margin: 0 0 1rem;\n}\n\n\n//\n// Images and content\n//\n\nimg {\n vertical-align: middle;\n border-style: none; // Remove the border on images inside links in IE 10-.\n}\n\nsvg {\n // Workaround for the SVG overflow bug in IE10/11 is still required.\n // See https://github.com/twbs/bootstrap/issues/26878\n overflow: hidden;\n vertical-align: middle;\n}\n\n\n//\n// Tables\n//\n\ntable {\n border-collapse: collapse; // Prevent double borders\n}\n\ncaption {\n padding-top: $table-cell-padding;\n padding-bottom: $table-cell-padding;\n color: $table-caption-color;\n text-align: left;\n caption-side: bottom;\n}\n\n// 1. Removes font-weight bold by inheriting\n// 2. Matches default `
` alignment by inheriting `text-align`.\n// 3. Fix alignment for Safari\n\nth {\n font-weight: $table-th-font-weight; // 1\n text-align: inherit; // 2\n text-align: -webkit-match-parent; // 3\n}\n\n\n//\n// Forms\n//\n\nlabel {\n // Allow labels to use `margin` for spacing.\n display: inline-block;\n margin-bottom: $label-margin-bottom;\n}\n\n// Remove the default `border-radius` that macOS Chrome adds.\n//\n// Details at https://github.com/twbs/bootstrap/issues/24093\nbutton {\n // stylelint-disable-next-line property-disallowed-list\n border-radius: 0;\n}\n\n// Explicitly remove focus outline in Chromium when it shouldn't be\n// visible (e.g. as result of mouse click or touch tap). It already\n// should be doing this automatically, but seems to currently be\n// confused and applies its very visible two-tone outline anyway.\n\nbutton:focus:not(:focus-visible) {\n outline: 0;\n}\n\ninput,\nbutton,\nselect,\noptgroup,\ntextarea {\n margin: 0; // Remove the margin in Firefox and Safari\n font-family: inherit;\n @include font-size(inherit);\n line-height: inherit;\n}\n\nbutton,\ninput {\n overflow: visible; // Show the overflow in Edge\n}\n\nbutton,\nselect {\n text-transform: none; // Remove the inheritance of text transform in Firefox\n}\n\n// Set the cursor for non-`