pictures

Using !important With CSS

hr
hr

I am not a “quick fix” or “work around” type of person. When a CSS debugging project comes my way I look first at fixing the problem systemically vs. applying the quick fix. Recently though I was brought into a project with an insane amount of CSS and conflicting styles all over the place. Since I did not have ample time to fix the issues systemically (this was a super stat job) I was forced to use something that would take precedence over the problematic styles already in place to quickly fix the issues.

If you have worked with CSS before I am sure you have seen “!important” used but probably were not really sure what it was. I ended up using a “fixes.css” style sheet which was called in after all the other style sheets and then using “!important” with the styles I needed to correct (override). This was very helpful and if you ever run into a similar situation or have a certain style that you cannot seem to figure out why something is not showing up (”I set this to have a margin-bottom:20px; but there is no margin at all”) try putting in the !important (margin-bottom:20px !important;) and see if that helps.

More information on !important: http://www.w3.org/TR/REC-CSS2/cascade.html#cascading-order

hr

Related Posts

Comments, Pingbacks and Tracebacks

(Comment icons use gravatars. Sign up for a gravatar so you can be cool too.)

hr

Leave a Reply


search

subscription information

Blog RSS

Comments RSS



Powered by FeedBlitz

blog categories

blog tags

most popular posts

  1. using parallels and windows for web development debugging.
  2. remove all .svn directories in a directory.
  3. wordpress newsletter plugin.
  4. php live training.
  5. jappler recommends: room & board (store).
  6. another good first tuesday in november.
  7. so long, farewell ben!
  8. feel better soon joe paterno.
  9. css containers: one image, fixed width, rounded corners.
  10. outlook users having issues with mail.app attachments.

blog archive

standards

Get Firefox!
XHTML
CSS