Re:TailwindCSS v2.0
by cosmotic on Wednesday November 18, 2020 @07:18PM
(#25144588)
Style attributes have very high specificity so they basically preclude using normal CSS files (they would mandate every line include !important)
[ Parent
| on HN ]
This is misleading, !important is not required to use inline styles.
They still cascade normally like CSS classes... see this example:
<div style="color: red">
<p>red text</p>
<p>red text</p>
<p style="color: blue">blue text</p>
</div>
Ironically, it's actually complex CSS classes and long selectors that produce high specificity, which then requires even more specificity to override and eventually the dreaded !importantIf an element has a style attribute that sets the color, it will override every single CSS/Style-element style that also sets the color, unless the CSS/Style-element style also includes an !important.