Timeline for answer to What are the implications of using "!important" in CSS? by Stephan Muller
Current License: CC BY-SA 3.0
Post Revisions
25 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Oct 14, 2022 at 3:25 | comment | added | Repo Men | !important will have a higher importance; that's weird to me heheh | |
| Jun 20, 2020 at 9:12 | history | edited | CommunityBot |
Commonmark migration
|
|
| Jul 21, 2016 at 2:33 | comment | added | Oli Studholme |
As an aside, element qualification (div.myDiv) is generally unnecessary, and should be avoided (→ .myDiv). That way you can use it to add additional specificity when needed (+ add a comment to note this).
|
|
| Jul 21, 2016 at 2:28 | comment | added | Oli Studholme | In stackoverflow.com/questions/29949824 you mentioned adding external refs for @LcSalazar, so here’s a link to CSS Lint’s explanation of their ‘Disallow !important’ rule, which links to additional references: github.com/CSSLint/csslint/wiki/Disallow-!important HTH | |
| Dec 8, 2015 at 15:32 | history | edited | Stephan Muller | CC BY-SA 3.0 |
added 245 characters in body
|
| Dec 8, 2015 at 15:23 | comment | added | alexwebb2 | @StephanMuller agree with the specifics, but not the headline / conclusion. The fact that !important isn't intended to be used everywhere doesn't mean it's "bad practice" any more than, say, using element IDs in selectors. You wouldn't do it for every rule - that would lead to some difficult to maintain code - but it certainly has its place, so I couldn't imaging calling it bad practice. | |
| Dec 7, 2015 at 14:58 | history | edited | Stephan Muller | CC BY-SA 3.0 |
added 66 characters in body
|
| Dec 7, 2015 at 14:52 | history | edited | TylerH | CC BY-SA 3.0 |
Minor phrasing changes and serial comma addition, as well as dependent clause denotation
|
| Dec 7, 2015 at 14:31 | comment | added | Stephan Muller | @alexwebb2 I completely rewrote the answer, it was very outdated and misinformed. Thoughts on the revision? | |
| Dec 7, 2015 at 14:19 | history | edited | Stephan Muller | CC BY-SA 3.0 |
added 1968 characters in body
|
| Sep 2, 2015 at 14:41 | comment | added | alexwebb2 |
It does not break cascading. It does not prevent user styles from being applied. Those are misunderstandings of the rules of CSS. !important is something you should use sometimes. It's only "bad practice" in the hands of a developer who doesn't understand what it does.
|
|
| Sep 2, 2015 at 14:26 | comment | added | alexwebb2 |
The FUD is strong with this answer. There's nothing wrong with using !important - there is, of course, plenty wrong with misusing it.
|
|
| Oct 16, 2014 at 20:21 | history | edited | TylerH | CC BY-SA 3.0 |
Encoded !important everywhere it was used for readability, revised grammar and fixed some spelling mistakes.
|
| Mar 14, 2012 at 16:33 | history | edited | BoltClock | CC BY-SA 3.0 |
syntax highlighting hint for css
|
| Nov 8, 2011 at 16:13 | comment | added | acme |
Normally it's really not necessary to use !important. But sometimes when you have to overwrite styles that have been set inline (e.g. by a JavaScript widget) it's the only way to change the css when you don't want to dive into JS.
|
|
| Oct 25, 2011 at 9:45 | comment | added | ANeves |
+0. Clarification/correction: user !important rules take precedence over anything else, including author !important rules: w3.org/TR/CSS2/cascade.html#cascading-order
|
|
| Sep 27, 2011 at 6:35 | history | edited | BoltClock | CC BY-SA 3.0 |
syntax highlight hint for html
|
| Dec 8, 2010 at 15:50 | history | edited | Stephan Muller | CC BY-SA 2.5 |
|
| Sep 14, 2010 at 17:13 | history | edited | Stephan Muller | CC BY-SA 2.5 |
deleted 4 characters in body
|
| Sep 14, 2010 at 7:59 | comment | added | Joeri Hendrickx | use firebug to check why another style rule is taking precedence. Then you can make sure yours is more specific, and override it that way. | |
| Sep 14, 2010 at 7:41 | vote | accept | Kyle | ||
| Sep 14, 2010 at 7:38 | comment | added | Kyle |
I understand. It's difficult to maintain an !importantless CSS file in this situation though. Of course I have added all new element selectors to the end of the the document, but sometimes it is just necessary to override some inherited values, no matter how specific my selector is, it's all that works. Thanks :)
|
|
| Sep 14, 2010 at 7:36 | history | edited | Stephan Muller | CC BY-SA 2.5 |
added 88 characters in body
|
| Sep 14, 2010 at 7:33 | history | edited | BoltClock | CC BY-SA 2.5 |
deleted 2 characters in body
|
| Sep 14, 2010 at 7:31 | history | answered | Stephan Muller | CC BY-SA 2.5 |