Hi, this explains it quite good.
it covers @RobM explanation of specificity and also points out the good times to use ID.
Anchors internal page links and sections, or when you have one particular thing that needs to be different from all the other things that use the same classes… but
in that case… you COULD just add another class to that thing, which is also more specific to that element, thereby making that ID case redundant.
and… you cold also reuse that class somewhere else.
If it was an ID, related stying you couldn’t.
since ID can only be used once, as you already know.
So Less code redundancy.
But basically as a general rule of thumb… dont use Inline Styles, no real reason too, unless rapidly prototyping…but even then, if your happy with the result, you then have to go over the same code again to REMOVE all the styling to a more sensible source yourself (preferably external stylesheet, followed by the next option of having all the styles in the head of your page
because otherwise, you have to sift through your web page code to find and change styling.- or use search and replace tools.
But then Tailwind etc… use inline utility classes…everywhere, lots of them…er ok.
So that blows that out of the water… but, TW implementation seems a little Retro to me.
But I have hardly used it, for that very reason, so others here could probably give more informed answer on the logic of that.