Anniversary Buttons Wersja z dnia 13:09, 11 lis 2016 autorstwa Bosal (dyskusja | edycje) (Utworzono nową stronę "__NOTOC__{{DISPLAYTITLE:Anniversary Buttons<span style="display: none"></span>}} <div class="col-md-12"> <div class="panel panel-primary"> <div class="panel-bo...")
Buttons
Button tags
Use the button classes on <a>
elements.
Note: The <a>
tag cannot be inserted into Mediawiki, instead use []
for external links and [[]]
for internal links.
Context-specific usage
While button classes can be used on <a>
elements are supported within the nav and navbar components.
Note: Traditional Bootstrap mark up uses <button>
, for Bootstrapskin we use <div class="btn btn-default">
Options
Use any of the available button classes to quickly create a styled button.
<div class="btn btn-default">Default</div> <div class="btn btn-primary">Primary</div> <div class="btn btn-success">Success</div> <div class="btn btn-info">Info</div> <div class="btn btn-warning">Warning</div> <div class="btn btn-danger">Danger</div>
Conveying meaning to assistive technologies
Using color to add meaning to a button 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 (the visible text of the button), or is included through alternative means, such as additional text hidden with the .sr-only
class.
Sizes
Fancy larger or smaller buttons? Add .btn-lg
, .btn-sm
, or .btn-xs
for additional sizes.
<div class="btn btn-default btn-lg">Large button</div> <div class="btn btn-default">Default button</div> <div class="btn btn-default btn-sm">Small button</div> <div class="btn btn-default btn-xs">Extra small button</div>
Active state
Buttons will appear pressed (with a darker background, darker border, and inset shadow) when active. For <button>
elements, this is done via :active
. For <a>
elements, it's done with .active
. However, you may use .active
on <div>
s (and include the aria-pressed="true"
attribute) should you need to replicate the active state programmatically.
Button element
No need to add :active
as it's a pseudo-class, but if you need to force the same appearance, go ahead and add .active
.
<div class="btn btn-default btn-lg active">Button</div>
Disabled state
Make buttons look unclickable by fading them back with opacity
.
Note: The disabled state does not currently work with Mediawiki, I may look to a fix for this at some stage.
Button element
Add the disabled
attribute to <button>
buttons.
Cross-browser compatibility
If you add the disabled
attribute to a <button>
, Internet Explorer 9 and below will render text gray with a nasty text-shadow that we cannot fix.
Link functionality caveat
This class uses pointer-events: none
to try to disable the link functionality of <a>
s, but that CSS property is not yet standardized and isn't fully supported in Opera 18 and below, or in Internet Explorer 11. 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, use custom JavaScript to disable such links.