Buttons
Bootstrap Buttons
Note: This documentation is for an older version of Bootstrap (v.4). A
newer version is available for Bootstrap 5. We recommend migrating to the latest version of our product - Material Design for
Bootstrap 5.
Go to docs v.5
Examples
Bootstrap includes several predefined button styles, each serving its own semantic purpose, with a few extras thrown in for more control.
<button type="button" class="btn btn-primary">Primary</button>
<button type="button" class="btn btn-secondary">Secondary</button>
<button type="button" class="btn btn-success">Success</button>
<button type="button" class="btn btn-danger">Danger</button>
<button type="button" class="btn btn-warning">Warning</button>
<button type="button" class="btn btn-info">Info</button>
<button type="button" class="btn btn-light">Light</button>
<button type="button" class="btn btn-dark">Dark</button>
<button type="button" class="btn btn-link">Link</button>
"Back to the top" button MDB Pro component"
A "Back to the top" button is very useful for long pages, especially on mobile devices.
Click the button below to see the live example.
Live exampleUsage: To make it work, you have to set the ID #top-section
to any element on the
top of the page.
<div class="fixed-action-btn smooth-scroll" style="bottom: 45px; right: 24px;">
<a href="#top-section" class="btn-floating btn-large red">
<i class="fas fa-arrow-up"></i>
</a>
</div>
Sizes
Fancy larger or smaller buttons? Add .btn-lg
or .btn-sm
for
additional sizes.
<button type="button" class="btn btn-default btn-lg">Large button</button>
<button type="button" class="btn btn-primary btn-lg">Large button</button>
<button type="button" class="btn btn-default btn-sm">Small button</button>
<button type="button" class="btn btn-primary btn-sm">Small button</button>
Create block level buttons—those that span the full width of a parent—by adding the class.btn-block
.
<button type="button" class="btn btn-default btn-lg btn-block">Block level button</button>
<button type="button" class="btn btn-primary btn-lg btn-block">Block level button</button>
Active state
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.
<a class="btn btn-primary btn-lg active" role="button" aria-pressed="true">Primary link</a>
<a class="btn btn-default btn-lg active" role="button" aria-pressed="true">Link</a>
Disabled state
Make buttons look inactive by adding the disabled
boolean attribute to any
<button>
element.
<button type="button" class="btn btn-primary btn-lg" disabled>Primary button</button>
<button type="button" class="btn btn-default btn-lg" disabled>Button</button>