PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Question about css & using !important to overwrite styles

  1. studioleland
    Member

    I have been using the GF forms for quite some time. Recently I had to do quite a bit of css work for a project and I found myself adding !important after almost every css class declaration in my style.css stylesheet so that it would be rendered instead of the default classes. Is there a place I should be declaring these custom css rules so that I don't have to declare an !important after each one. It becomes rather tedious. I usually start with the default css as a base and work from there so I can maintain the basic form styles which come packaged with GF for standards compliance.

    Posted 13 years ago on Friday March 18, 2011 | Permalink
  2. If you use better CSS specificity, then you shouldn't have to resort to using the !important declaration too often.

    This guide has some samples that should get you going in the right direction.

    http://www.rocketgenius.com/gravity-forms-css-targeting-specific-elements/

    If you want to know more about CSS specificity, then here's probably more than you'll ever need.

    http://www.smashingmagazine.com/2007/07/27/css-specificity-things-you-should-know/

    Posted 13 years ago on Friday March 18, 2011 | Permalink