📅  最后修改于: 2023-12-03 14:39:33.576000             🧑  作者: Mango
Bootstrap 5 provides a variety of styles for creating buttons. Buttons can be customized with various size, color, and state options. This makes it easy to create user-friendly and interactive interfaces for your web applications.
To create a button in Bootstrap 5, use the following HTML code:
<button type="button" class="btn btn-primary">Primary</button>
This will produce a primary button with blue background color. You can customize the button by changing the class to one of the available options.
Bootstrap 5 provides four different size options for buttons. You can modify the size of the button by adding class btn-lg
, btn-sm
, or btn-xs
:
<button type="button" class="btn btn-primary btn-lg">Large</button>
<button type="button" class="btn btn-primary">Default</button>
<button type="button" class="btn btn-primary btn-sm">Small</button>
<button type="button" class="btn btn-primary btn-xs">Extra small</button>
Bootstrap 5 provides a variety of color options for buttons. You can modify the color of the button by changing the class to one of the following:
btn-primary
btn-secondary
btn-success
btn-danger
btn-warning
btn-info
btn-light
btn-dark
btn-link
<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>
Bootstrap 5 provides a way to change the appearance of a button based on its state. You can modify the state of the button by adding class active
, disabled
, or loading
:
<button type="button" class="btn btn-primary active">Active Button</button>
<button type="button" class="btn btn-primary disabled">Disabled Button</button>
<button type="button" class="btn btn-primary loading">Loading Button</button>
Bootstrap 5 provides a simple and effective way to create buttons with many customization options. By using these options, you can create user-friendly and interactive interfaces for your web applications.