3 ms·
To honest, I don't have the time to become a CSS expert so I do what works and I don't worry much about it. I use "!important" quite a bit because I let users
by oblib 5y ago
To honest, I don't have the time to become a CSS expert so I do what works and I don't worry much about it.
I use "!important" quite a bit because I let users made some choices in the color schemes of the app and using "!important" makes that easy for me to do.
- lmc 5y agoPlease, put an id on the HTML element, and a CSS rule targeting that id, rather than use !important. !important really was a mistake and should only be used to counteract other uses of !important you don't have control over.
- asddubs 5y agoalso inline styles you have no control over
- oblib 5y ago>> !important really was a mistake and should only be used to counteract other uses of !important you don't have control over. That's mainly when I use it. Mostly to override colors Bootstrap CSS has defined with it. For example a nav background color set in the Bootstrap file "/scss/mixins/_background-variant.scss": .bg-light { background-color: #f8f9fa!important; } By default I use that, but I also let users select a CSS file to override that with a color they chose from a list of "themes" I've made. My themes only change a small bit of what Bootstrap CSS has described in their themes. It wouldn't make any sense for me to do anything more than that because it works works and it's easy for me to implement the change.