Yes, !important is bad practice. !important was initally designed to help people with visual impairments overwrite the stylesheets of websites. Accessibility software/plugins use !important to overwrite the default rules in a website's css.
Using !important in your css can sometimes be useful to force a rule, but it has some implications:
Your stylesheet isn't cascading anymore. Where you can usually rely in the fact that further down rules overwrite the rules that are higher up in the stylesheet, with !important you can never be sure. This means you have remember which rules you assigned as !important or have to search for them everytime you edit your css
Users that use accessibility software may experience problems seeing your website.
Solutions:
- Make better use of CSS' cascading properties
Use more specific rules. By indicating one or more elements before the element you're selecting the rule is more specific and gets higher priority:
<div id="test">
<span>Text</span>
</div>
div#test span { color: green }
span { color: red }
div span { color: blue }
No matter what the order, the text will be green because that rule is most specific. (Also, the rule for blue overwrites the rule for red, no matter the order of the rules)