-3

This question already has an answer here:

I was just trying IDs on the CSS tab and I noticed that a little warning sign appeared "Don't use IDs in selectors"

Why does the CSS tap recommend me not to use IDs in selectors?. Is there something wrong about them? (the selector seems to work perfectly).

The "{}" code sample says my code is wrong too.

marked as duplicate by gnat, John Wu, Robert Harvey, TZHX, user22815 Jul 17 '17 at 21:07

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

0

The case of whether to use ID selectors is definitely a divisive one. One of the main reasons some developers advise against using them is down to their high specificity, which can make it harder to use new rules. This article provides a specific example of this problem.

Also, because they can only be used by one HTML element (or at least are supposed to be) using them can lead you to having to rewrite similar CSS styles.

Not the answer you're looking for? Browse other questions tagged or ask your own question.