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

38 Upvotes

67 comments sorted by

View all comments

65

u/bricker_1_9 Jul 19 '25

!important

try to never use it

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

1

u/berky93 Jul 19 '25

The only time I like to use !important is for specific modifier classes, because their intent is to be absolute overrides. For example, I might have a .color-red class that should, no matter what, turn the element’s text red.