diff options
| author | Mark Otto <[email protected]> | 2022-12-29 14:19:22 -0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-12-29 14:19:22 -0800 |
| commit | 9e17b2b34cdec9dce063bba09b01aa9a63e7dd94 (patch) | |
| tree | b7199331dcfef038272229e3fb10133d502828cf /site/content/docs/5.3/customize/css-variables.md | |
| parent | 1a043b55bcfe3b9b1f327fe78639b82321f38633 (diff) | |
| download | bootstrap-9e17b2b34cdec9dce063bba09b01aa9a63e7dd94.tar.xz bootstrap-9e17b2b34cdec9dce063bba09b01aa9a63e7dd94.zip | |
Focus ring helper and utilities (#33125)
* Add global variables for box-shadow focus rings
* Update instances of -btn-focus-box-shadow to use -ring-box-shadow, unless it's for buttons or inputs
* fix variable name
* Add CSS variables for global focus styling, document it
* Move to CSS vars section
* Update scss/_nav.scss
Co-authored-by: Gaël Poupard <[email protected]>
* Helper and utils
* Fix bundlewatch
* Change 'Focus ring' in sidebar so that the page can be visible
* Minor typo fix
* fix merge
* Revamp some more, improve docs
Co-authored-by: Gaël Poupard <[email protected]>
Co-authored-by: Julien Déramond <[email protected]>
Co-authored-by: Patrick H. Lauke <[email protected]>
Diffstat (limited to 'site/content/docs/5.3/customize/css-variables.md')
| -rw-r--r-- | site/content/docs/5.3/customize/css-variables.md | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/site/content/docs/5.3/customize/css-variables.md b/site/content/docs/5.3/customize/css-variables.md index 838a1abf7..ffb40c0c4 100644 --- a/site/content/docs/5.3/customize/css-variables.md +++ b/site/content/docs/5.3/customize/css-variables.md @@ -74,6 +74,20 @@ a { } ``` +## Focus variables + +{{< added-in "5.3.0" >}} + +Bootstrap provides custom `:focus` styles using a combination of Sass and CSS variables that can be optionally added to specific components and elements. We do not yet globally override all `:focus` styles. + +In our Sass, we set default values that can be customized before compiling. + +{{< scss-docs name="focus-ring-variables" file="scss/_variables.scss" >}} + +Those variables are then reassigned to `:root` level CSS variables that can be customized in real-time, including with options for `x` and `y` offsets (which default to their fallback value of `0`). + +{{< scss-docs name="root-focus-variables" file="scss/_root.scss" >}} + ## Grid breakpoints While we include our grid breakpoints as CSS variables (except for `xs`), be aware that **CSS variables do not work in media queries**. This is by design in the CSS spec for variables, but may change in coming years with support for `env()` variables. Check out [this Stack Overflow answer](https://stackoverflow.com/a/47212942) for some helpful links. In the meantime, you can use these variables in other CSS situations, as well as in your JavaScript. |
