Skip to content

Commit

Permalink
Move to CSS vars section
Browse files Browse the repository at this point in the history
  • Loading branch information
mdo committed Nov 11, 2022
1 parent 9e27c23 commit 2eede6c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
10 changes: 0 additions & 10 deletions site/content/docs/5.2/content/reboot.md
Original file line number Diff line number Diff line change
Expand Up @@ -374,16 +374,6 @@ Reboot includes an enhancement for `role="button"` to change the default cursor
<span role="button" tabindex="0">Non-button element button</span>
{{< /example >}}

## Focus state

<small class="d-inline-flex px-2 py-1 font-monospace text-muted border rounded-3">Added in v5.3.0</small>

Bootstrap globally updates the styling for `:focus` styles using a combination of Sass and CSS variables. In our Sass, we set default values that can be customized pre-compiling. 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="focus-ring-variables" file="scss/_variables.scss" >}}

{{< scss-docs name="root-focus-variables" file="scss/_root.scss" >}}

## Misc elements

### Address
Expand Down
14 changes: 14 additions & 0 deletions site/content/docs/5.2/customize/css-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,20 @@ a {
}
```

## Focus variables

<small class="d-inline-flex px-2 py-1 font-monospace text-muted border rounded-3">Added in v5.3.0</small>

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 pre-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.

0 comments on commit 2eede6c

Please sign in to comment.