2 ms·
Ids overpower everything else in the css cascade, in particular any utilities like tailwind’s (unless you activate !important for utils, which also has its casc
by AltruisticGapHN 6y ago
Ids overpower everything else in the css cascade, in particular any utilities like tailwind’s (unless you activate !important for utils, which also has its cascading effects and heavyhanded fix).
Using an id is not inherently wrong, and with stylelint you can always disable a rule for the exceptions, with a comment of the form /* stylelint-disable-next-line <optional specific rule id> */
Nowadays esp. with composition methodology it’s almost always better to just use a unique bem like class, eg. .HomepageHero-carousel , even if the element in question is a "singleton"... because later someone can stick a mb-4 on it, or a text-lg , or even your own custom utility or modifier and it will stick, without snowballing css selector complexity.