From e2e107fc7215f36ff73cf2fbb29e35d703a82679 Mon Sep 17 00:00:00 2001 From: Louis-Maxime Piton Date: Fri, 20 May 2022 19:28:31 +0200 Subject: [PATCH] CSS: few proposals (#36406) * Something to try about `!important` in color-bg helper * Better understanding border utility `.border-*-0` * Having rounded numbers of px --- scss/helpers/_color-bg.scss | 6 +++--- site/assets/scss/_component-examples.scss | 10 ++-------- site/content/docs/5.2/utilities/borders.md | 12 ++++++------ 3 files changed, 11 insertions(+), 17 deletions(-) diff --git a/scss/helpers/_color-bg.scss b/scss/helpers/_color-bg.scss index 80ba863034a8..b5ce7709c178 100644 --- a/scss/helpers/_color-bg.scss +++ b/scss/helpers/_color-bg.scss @@ -1,10 +1,10 @@ -// stylelint-disable declaration-no-important, function-name-case +// stylelint-disable function-name-case // All-caps `RGBA()` function used because of this Sass bug: https://github.com/sass/node-sass/issues/2251 @each $color, $value in $theme-colors { $color-rgb: to-rgb($value); .text-bg-#{$color} { - color: color-contrast($value) !important; - background-color: RGBA($color-rgb, var(--#{$prefix}bg-opacity, 1)) !important; + color: color-contrast($value) if($enable-important-utilities, !important, null); + background-color: RGBA($color-rgb, var(--#{$prefix}bg-opacity, 1)) if($enable-important-utilities, !important, null); } } diff --git a/site/assets/scss/_component-examples.scss b/site/assets/scss/_component-examples.scss index 52b67543a8ba..6f325689462e 100644 --- a/site/assets/scss/_component-examples.scss +++ b/site/assets/scss/_component-examples.scss @@ -257,12 +257,6 @@ } } -.bd-example-border-utils-0 { - [class^="border"] { - border: var(--#{$prefix}border-width) solid var(--#{$prefix}border-color); - } -} - .bd-example-rounded-utils { [class*="rounded"] { margin: .25rem; @@ -325,8 +319,8 @@ pre { padding: 0; - margin-top: .65rem; - margin-bottom: .65rem; + margin-top: .625rem; + margin-bottom: .625rem; white-space: pre; background-color: transparent; border: 0; diff --git a/site/content/docs/5.2/utilities/borders.md b/site/content/docs/5.2/utilities/borders.md index 0cf9a7454660..64913bbc915e 100644 --- a/site/content/docs/5.2/utilities/borders.md +++ b/site/content/docs/5.2/utilities/borders.md @@ -26,12 +26,12 @@ Add borders to custom elements: Or remove borders: -{{< example class="bd-example-border-utils bd-example-border-utils-0" >}} - - - - - +{{< example class="bd-example-border-utils" >}} + + + + + {{< /example >}} ## Color