Skip to main content Skip to docs navigation
in English

Accessibility

A brief overview of Bootstrap’s features and limitations for the creation of accessible content.

Bootstrap provides an easy-to-use framework of ready-made styles, layout tools, and interactive components, allowing developers to create websites and applications that are visually appealing, functionally rich, and accessible out of the box.

Overview and limitations

The overall accessibility of any project built with Bootstrap depends in large part on the author’s markup, additional styling, and scripting they’ve included. However, provided that these have been implemented correctly, it should be perfectly possible to create websites and applications with Bootstrap that fulfill WCAG 2.1 (A/AA/AAA), Section 508, and similar accessibility standards and requirements.

Structural markup

Bootstrap’s styling and layout can be applied to a wide range of markup structures. This documentation aims to provide developers with best practice examples to demonstrate the use of Bootstrap itself and illustrate appropriate semantic markup, including ways in which potential accessibility concerns can be addressed.

Interactive components

Bootstrap’s interactive components—such as modal dialogs, dropdown menus, and custom tooltips—are designed to work for touch, mouse, and keyboard users. Through the use of relevant WAI-ARIA roles and attributes, these components should also be understandable and operable using assistive technologies (such as screen readers).

Because Bootstrap’s components are purposely designed to be fairly generic, authors may need to include further ARIA roles and attributes, as well as JavaScript behavior, to more accurately convey the precise nature and functionality of their component. This is usually noted in the documentation.

Color contrast

Qee qhov kev sib txuas ntawm cov xim uas tam sim no ua rau Bootstrap lub palette default-siv thoob plaws hauv lub moj khaum rau tej yam xws li khawm variations, ceeb toom variations, daim ntawv validation indicators, As yuav ua rau tsis txaus xim sib piv (hauv qab cov lus pom zoo WCAG 2.1 ntawv xim sib piv piv ntawm 4.5:1 thiab WCAG 2.1 tsis yog cov ntawv xim sib piv ntawm 3: 1 ), tshwj xeeb tshaj yog thaum siv tawm tsam lub teeb tom qab. Cov kws sau ntawv raug txhawb kom sim lawv cov kev siv xim tshwj xeeb thiab, yog tias tsim nyog, hloov kho / txuas ntxiv cov xim no kom paub meej cov xim zoo sib xws.

Visually zais cov ntsiab lus

Cov ntsiab lus uas yuav tsum tau muab zais tsis pom kev, tab sis tseem tuaj yeem nkag mus rau cov cuab yeej pabcuam xws li kev tshuaj ntsuam nyeem, tuaj yeem tsim qauv siv .visually-hiddenchav kawm. Qhov no tuaj yeem muaj txiaj ntsig zoo rau cov xwm txheej uas cov ntaub ntawv pom lossis cov lus qhia ntxiv (xws li lub ntsiab lus qhia los ntawm kev siv xim) yuav tsum tau xa mus rau cov neeg siv tsis pom kev.

<p class="text-danger">
  <span class="visually-hidden">Danger: </span>
  This action is not reversible
</p>

Rau qhov pom kev zais kev sib tham sib tswj, xws li cov kev sib txuas "skip" ib txwm, siv .visually-hidden-focusablechav kawm. Qhov no yuav xyuas kom meej tias kev tswj tau pom ib zaug tsom (rau cov neeg siv cov keyboard pom). Saib xyuas, piv rau qhov sib npaug .sr-onlythiab .sr-only-focusablecov chav kawm nyob rau yav dhau los versions, Bootstrap 5's .visually-hidden-focusableyog chav kawm nyob ib leeg, thiab yuav tsum tsis txhob siv ua ke nrog cov .visually-hiddenchav kawm.

<a class="visually-hidden-focusable" href="#content">Skip to main content</a>

Txo cov lus tsa suab

Bootstrap suav nrog kev txhawb nqa rau kev prefers-reduced-motiontshaj tawm feature . Hauv browsers / ib puag ncig uas tso cai rau tus neeg siv qhia lawv qhov kev nyiam rau kev txo qis, feem ntau CSS hloov pauv cuam tshuam hauv Bootstrap (piv txwv li, thaum lub rooj sib tham qhib lossis kaw, lossis zawv zawg animation hauv carousels) yuav ua tsis taus, thiab muaj txiaj ntsig animations ( xws li spinners) yuav qeeb.

Ntawm cov browsers uas txhawb nqa prefers-reduced-motion, thiab qhov twg tus neeg siv tsis tau qhia meej meej tias lawv xav kom txo cov lus tsa suab (piv txwv li qhov twg prefers-reduced-motion: no-preference), Bootstrap enables smooth scrolling siv cov scroll-behaviorcuab yeej.

Cov peev txheej ntxiv