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.

Styling with CSS Class/Remove bullets

  1. Hi,

    Sorry if this explained somewhere, but I can't find the answer for it in the forums.

    I need a simple explanation on how to add my own style to a form, using CSS. I added a form to my site but I think I may be doing something wrong when using the CSS Class field, because nothing changes.

    Can you paste here an example of how the code should look in style.css and also an example of how the code snippet should look on the "CSS Class" field to override the style of a certain form field?

    I need to remove the bullets and some style from the list...even when I disable the Output CSS option it keeps pulling the style from style.css and displaying the bullets.

    Thank you very much and sorry for the trouble!

    Tyago Neres

    Posted 11 years ago on Thursday October 8, 2009 | Permalink
  2. Is there a link to a form on one of your sites where we can see this happening and then can create a quick CSS code snippet based on what you are trying to do?

    Posted 11 years ago on Thursday October 8, 2009 | Permalink
  3. Here is the link:

    http://condominiobarlavento.com.br/contato

    Please paste an example here of how the code should look in the stylesheet and in the CSS Class field.

    Thanks!

    Posted 11 years ago on Thursday October 8, 2009 | Permalink
  4. Right now your theme stylesheet is tellingall LI elements to use a background-image for a bullet. To eliminate the inheritance of the list background-image you can place this code in your themes stylesheet file:

    .gform_body li {background-image: none;}

    This sets the background image of all li's within the gform_body class to none.

    You would use similar code to style other elements of the form. You will need to view the source to see what class and id's are being used for the form to know what to styles you will need to override.

    Posted 11 years ago on Thursday October 8, 2009 | Permalink
  5. John Preston
    Member

    I'm having the same issue even after appending the style sheet with the above code over at

    http://www.k9toronto.com/?page_id=153

    Any help would be appreciated.

    Thanks
    John

    Posted 11 years ago on Monday December 7, 2009 | Permalink
  6. Hello John, this is due to inheritance from your theme. You can get around this by changing the following in your CSS.

    Change this in your theme CSS from:

    .gform_body li {background-image: none;}

    To this:

    .gform_body li {background-image: none !important;}

    Posted 11 years ago on Monday December 7, 2009 | Permalink
  7. John, see if this works for you. I added a couple of declarations to override some of the inherited margins/padding too.

    .gform_wrapper li, .gform_wrapper form li, .gform_wrapper form ul li { list-style-type:none!important; background-image:none!important; padding-left:0!important; margin-left:0!important}
    Posted 11 years ago on Monday December 7, 2009 | Permalink
  8. John Preston
    Member

    Thanks Carl and thanks Kevin. Much appreciated.

    John

    Posted 11 years ago on Monday December 7, 2009 | Permalink
  9. John Preston
    Member

    I've noticed that trying to affect a style change by including a "CSS Class Name" in the advanced tab of a gravityform doesn't work for me at all. I've also noted that in the above suggestions the "!important" tag/element seems to be essential when adding styles to the style sheet.

    Could someone explain why this is? Is this a bug? Is it possible to have all of the styles for the form available to import into the style sheet so that I can begin to change the look from really kinda ugly to not too bad?

    Thanks
    John

    Posted 11 years ago on Tuesday December 8, 2009 | Permalink
  10. I'm not sure why you're not having luck with adding a class name, but I would venture to guess that it's being applied correctly and some other style declaration is overriding what you're trying to do.

    I don't see any extra classes custom classes in your form markup right now so it's hard to tell for sure.

    The "!important" is basically in the examples we sent as a way to override inheritance from other styles. It's not because of a bug, it's just a way to ensure the new style declaration is prioritized.

    If you're wanting to make extensive changes to your form, this is the recommended way to go ahead with it. Go to the wp-content/plugins/gravityforms/css folder, open up the forms.css file and copy the entire contents to your clipboard. Then, go to your theme folder, open up the theme style sheet and paste the form styles at the end of the document (don't overwrite what's there, just append).

    After that, go to the Gravity Forms settings page in WP and uncheck the "output CSS" option at the top, right below the license key field. That way, GF won't load the default styles.

    Now you can modify the form styles in your theme style sheet to your liking.

    If you were to make extensive mods to the default forms.css, when you automatically update the plugin they would be overwritten so that's the reason we suggest doing it this way.

    Posted 11 years ago on Tuesday December 8, 2009 | Permalink
  11. John Preston
    Member

    Thanks Kevin,

    That was a very thorough response. Will attempt to do as suggested.

    John

    Posted 11 years ago on Tuesday December 8, 2009 | Permalink
  12. John Preston
    Member

    I'm seeing cross-eyed now. I'm trying to find the code that will reduce the roughly 100 px gap between the page title and the start of the form over at:

    http://www.k9toronto.com/?page_id=259

    Perhaps this has to do with the fact that I took out the form title and description.

    Any thoughts?

    John

    Posted 11 years ago on Tuesday December 8, 2009 | Permalink
  13. If you don't want the Form Title or Form Description being output on the page, then you need to tell Gravity Forms not to display them. Simply clearing out the values in the Form Settings for that Form will not do that. This is done via the short code.

    When you insert a form on a page or post using the insert form button you can tell it not to display the Title or Description. If you tell it not to display these elements it will output less markup on the page.

    A short code to display a form without the title and without the description would look like this:

    [gravityform id=XX title=false description=false]

    Posted 11 years ago on Tuesday December 8, 2009 | Permalink
  14. John Preston
    Member

    Thanks Carl, I reinstalled the form on that page and deselected the fields you suggested.

    My biggest concern has been the seemingly massive amount of style info that gets put into the style sheet — so much so, that I spent a few hours trying to locate the style code that would allow me to add padding under the drop down fields given how bunched up they are on my page.

    I wasn't able to find it, at least I was not able to isolate the drop down fields specifically without adding to the padding of the rest of the field styles, which I didn't want. Is there a way to do this?

    Thanks

    Posted 11 years ago on Wednesday December 9, 2009 | Permalink
  15. You can target specific drop downs using their id. Every field has a unique id. You don't have to globally target all fields. You can also target just select drop downs by targeting selects (not inputs) which would only apply styles to a select drop down and not impact inputs.

    The CSS is complex, but it has to be in order to support a form builder that allows you to configure your own form on the fly. It has to be flexible to handle a variety of situations.

    There are a variety of ways you can do what you are trying to do, there isn't one single way to do it. The CSS that is there provides for so many different ways to accomplish what you want, both by targeting things globally or targeting specific fields using their field ids.

    If you aren't already using it I would suggest using the Firebug extension for FireFox or Safari's Inspector to view the code. It makes it quick and easy to view the source and determine what you need to target using CSS. They also allow you to make changes to the CSS from within the browser and see how it impacts the page on the fly before you actually implement the change.

    Posted 11 years ago on Wednesday December 9, 2009 | Permalink
  16. John Preston
    Member

    "If you aren't already using it I would suggest using the Firebug extension for FireFox or Safari's Inspector to view the code."

    OMG. Thanks for the tip. Just when I fell in love with the Chrome beta for the Mac. Back to Firefox!

    John

    Posted 11 years ago on Wednesday December 9, 2009 | Permalink
  17. John Preston
    Member

    The forms.css sheet that I imported into my style sheet doesn't include the gform_body element that was suggested above by Kevin (which was successful in removing my bullet problem). Are there other gform_body adjustments that can be made or was the bullet problem the only problem that required going up from the wrapper to the body level?

    John

    Posted 11 years ago on Wednesday December 9, 2009 | Permalink
  18. gform_body element may not be there because it isn't styled by default. But the class exists in case you want to target it.

    Kevin's code targeted all li's within gform_body so that only the li's within that container would be changed. It is just one of many ways to do what you are trying to do with removing the bullets.

    How wide you cast your net as far as CSS inheritance goes is going to vary depending on what you are trying to accomplish.

    Unfortunately some themes developers make the decision to cast their net so wide that it causes CSS inheritance on elements end users aren't going to want... such as the bullets you wanted tremoved.

    Posted 11 years ago on Wednesday December 9, 2009 | Permalink
  19. John Preston
    Member

    Hello again,

    I'm trying to add padding between the fields like "cell phone" and "work phone" and have had no luck. Even targeting them as individual fields in the style sheet doesn't work. Any suggestions?

    http://www.k9toronto.com/sign-up/

    Posted 11 years ago on Thursday December 31, 2009 | Permalink
  20. John Preston
    Member

    In addition,

    I can target a Single Line Text field (from the standard fields) but not, say, a Phone field from the advanced fields.

    John

    Posted 11 years ago on Thursday December 31, 2009 | Permalink
  21. It looks like it's inheriting some blanket UL styles from your theme style sheet. You can try this

    .top_label li#field_2_61, .top_label li#field_2_5, .top_label li#field_2_41 {margin:10px 0 0 0!important;}

    just adjust everything to your preference. That should reset the spacing on the list item containers for those fields. You can see the results from my test below.

    screenshot

    Posted 11 years ago on Thursday December 31, 2009 | Permalink
  22. John Preston
    Member

    Thanks Kevin — that worked great.

    Also, I filled in a phone field of a online form recently (not a Gravity Form) that had 3 subfields for the phone field (area code, prefix, and last 4 digits).

    Is this possible with Gravity Forms or should I post this under the wish list (if you have one).

    John

    Posted 11 years ago on Thursday December 31, 2009 | Permalink
  23. Hey John, glad that worked for ya.

    The phone field is currently just the single input. I'm not sure if we're going to offer an option to split it up into 3 fields or not.. we may implement some other input "masking" options to automatically format the number as it's entered. You're welcome to post a request in the "feature request" category and we'll definitely consider it.

    Posted 11 years ago on Thursday December 31, 2009 | Permalink

This topic has been resolved and has been closed to new replies.