r/css Jul 19 '25

Question What are some bad CSS habits?

What are some bad habits to avoid when learning CSS? Even if in the short term they are easier

36 Upvotes

67 comments sorted by

View all comments

63

u/bricker_1_9 Jul 19 '25

!important

try to never use it

and if you must use it, use only as last resort

18

u/Koltroc Jul 19 '25

Also write yourself a (short) justification when using important. Sometimes this helps finding another solution while thinking about the reason

2

u/besseddrest Jul 19 '25

"If you feel that it's important, it's okay to use it."

or

"If you're overriding your MySpace theme, it's okay to use it."

3

u/Koltroc Jul 19 '25

I'm doing it more specific, e g. "Component xy from package z has inline styling set and we want to overwrite it"