This is the only unprefixed custom property, and its name is very common so I think we'd better prefix it too.
&::before {
display: block;
- padding-top: var(--aspect-ratio);
+ padding-top: var(--#{$variable-prefix}aspect-ratio);
content: "";
}
@each $key, $ratio in $aspect-ratios {
.ratio-#{$key} {
- --aspect-ratio: #{$ratio};
+ --#{$variable-prefix}aspect-ratio: #{$ratio};
}
}
width: 16rem;
@include media-breakpoint-up(md) {
- --aspect-ratio: 50%; // 2x1
+ --bs-aspect-ratio: 50%; // 2x1
}
}
}
Each `.ratio-*` class includes a CSS custom property (or CSS variable) in the selector. You can override this CSS variable to create custom aspect ratios on the fly with some quick math on your part.
-For example, to create a 2x1 aspect ratio, set `--aspect-ratio: 50%` on the `.ratio`.
+For example, to create a 2x1 aspect ratio, set `--bs-aspect-ratio: 50%` on the `.ratio`.
{{< example class="bd-example-ratios" >}}
-<div class="ratio" style="--aspect-ratio: 50%;">
+<div class="ratio" style="--bs-aspect-ratio: 50%;">
<div>2x1</div>
</div>
{{< /example >}}
```scss
.ratio-4x3 {
@include media-breakpoint-up(md) {
- --aspect-ratio: 50%; // 2x1
+ --bs-aspect-ratio: 50%; // 2x1
}
}
```
#### Utilities
+- Renamed `--aspect-ratio` to `--bs-aspect-ratio` to be consistent with other custom properties.
- Extended the `.visually-hidden-focusable` helper to also work on containers, using `:focus-within`.
- `bootstrap-utilities.css` now also includes our helpers. Helpers don't need to be imported in custom builds anymore.
- Extended form validation states customization capabilities. Added three new optional parameters to the `form-validation-state` mixin: `tooltip-color`, `tooltip-bg-color`, `focus-box-shadow`. These parameters can be set in the `$form-validation-states` map. [See #31757](https://github.com/twbs/bootstrap/pull/31757).