Use Bootstrap’s custom button styles for actions in forms, dialogs, and more with support for multiple sizes, states, and more. ExamplesBootstrap includes several predefined button styles, each serving its own semantic purpose, with a few extras thrown in for more control. Primary Secondary Success Danger Warning Info Light Dark Link
Conveying meaning to assistive technologiesUsing 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 2 class.The 3 classes are designed to be used with the element. However, you can also use these classes on 4or 4 elements (though some browsers may apply a slightly different rendering).When using button classes on 4elements 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 7 to appropriately convey their purpose to assistive technologies such as screen readers.
8Outline buttonsIn need of a button, but not the hefty background colors they bring? Replace the default modifier classes with the 9 ones to remove all background images and colors on any button.Primary Secondary Success Danger Warning Info Light Dark
SizesFancy larger or smaller buttons? Add 0 or 1 for additional sizes.
Create block level buttons—those that span the full width of a parent—by adding 2.Block level button Block level button
Active stateButtons will appear pressed (with a darker background, darker border, and inset shadow) when active. There’s no need to add a class to s as they use a pseudo-class. However, you can still force the same active appearance with 3 (and include the 4 attribute) should you need to replicate the state programmatically.
Disabled stateMake buttons look inactive by adding the 5 boolean attribute to any element. 6Disabled buttons using the 4element behave a bit different:
Link functionality caveatThe 0 class uses 4 to try to disable the link functionality of 4s, but that CSS property is not yet standardized. In addition, even in browsers that do support 4, 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 7 attribute on these links (to prevent them from receiving keyboard focus) and use custom JavaScript to disable their functionality.Button pluginDo more with buttons. Control button states or create groups of buttons for more components like toolbars. Toggle statesAdd 8 to toggle a button’s 9 state. If you’re pre-toggling a button, you must manually add the 3 class and 4 to the . 2Checkbox and radio buttonsBootstrap’s 3 styles can be applied to other elements, such as 4s, to provide checkbox or radio style button toggling. Add 5 to a 6 containing those modified buttons to enable their toggling behavior via JavaScript and add 7 to style the 4s 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 9 event on the button. If you use another method to update the input—e.g., with 4 or by manually applying the input’s 1 property—you’ll need to toggle 3 on the 4 manually.Note that pre-checked buttons require you to manually add the 3 class to the input’s 4. |