Re:CSS coding techniques
by waylandsmithers on Friday May 20, 2016 @08:22AM
(#11737179)
The only situation I can justify using it for is to override inline styles that jQuery can leave behind in the DOM. Other than that, I haven't seen any legitimate cases for using it to get past the normal specificity rules.
[ Parent
| on HN ]
I use it for 'style classes' that you add to an element purely to get some styling change - for example '.pad-left' or '.text-center'. In this case you may be trying to override a style from a stronger selector like `.table td { text-align: left }`.
With style classes you don't run in to the issue of needing to then override the !important rule w/ another important rule - you would just remove the style class.