As I work on theming my website, which utilizes Bootstrap, I am making adjustments to the Bootstrap variables. Some variables are defined against the :root
element in a way that allows me to easily override them:
:root {
--bs-body-color: red;
}
However, there are others like --bs-navbar-color
that are specified against selectors. To override these without needing to specify specific selectors, I have found that applying the style universally works:
:root * {
--bs-navbar-color: blue !important;
}
I wonder if this approach is considered poor practice. It does seem to be effective, and while it may not be recommended for typical styles, it doesn't appear to cause significant issues when working with CSS variables.