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.

CSS not being applied to IDs

  1. dodonest
    Member

    I'm trying to apply custom css to the field label on id 1 and for some reason it not being applied?

    [css]
    .gform_wrapper_1 .left_label .gfield_label {
        color: ;
        float: left;
        font-weight: bold;
        margin: 2px 15px 0 0;
        width: 29%;
    }

    Thanks,
    K

    Posted 13 years ago on Thursday July 14, 2011 | Permalink
  2. You're using a class identifier (dot) and trying to taget an ID and that won't work. It also ooks like your color property was left empty. That's probably breaking the rest of the properties you're trying to define in that rule.

    Try this

    [css]
    body #gform_wrapper_1 .left_label .gfield_label {
        color:#000;
        float: left;
        font-weight: bold;
        margin: 2px 15px 0 0;
        width: 29%
    }

    http://www.gravityhelp.com/documentation/page/CSS_Targeting_Samples

    Posted 13 years ago on Thursday July 14, 2011 | Permalink
  3. dodonest
    Member

    So I have to actually include "body" in front of #gform?

    Also, in order for the css to display I "Don't" need to add "#gform_wrapper_1" to CSS Class Name in the Form Setting?

    Posted 13 years ago on Thursday July 14, 2011 | Permalink
  4. nope, you may not NEED the "body" in the rule, but the better the specificity in the rule, the less problems you'll have overriding other theme styles so I recommend it.

    You don't need to add anything to your class names in the form editor because the "gform_wrapper_1" ID is something that's automatically applied when the form is rendered.

    Posted 13 years ago on Thursday July 14, 2011 | Permalink
  5. dodonest
    Member

    This is the CSS I'm working with at the moment while I'm testing this out.

    [css]
    body .gform_wrapper_1 .left_label .gfield_label {
        color: #71277A;
        float: none;
        font-weight: bold;
        margin: 2px 15px 0 0;
        width: 29%;
    }
    body .gform_wrapper_1 .right_label div.ginput_complex, .gform_wrapper .left_label div.ginput_complex {
        float: none;
        width: 64%;
    }
    body .gform_wrapper_1 .right_label input.small, .gform_wrapper .right_label select.small, .gform_wrapper .left_label input.small, .gform_wrapper .left_label select.small {
        font-size: 14px;
        width: 15%;
    }

    When I remove _1 the CSS displays? If I place the _1 after wrapper it's disabling the css for some reason.

    Posted 13 years ago on Thursday July 14, 2011 | Permalink
  6. That's exactly the point I'm making.

    ".gform_wrapper_1" (dot) indicates that you are targeting a reusable class name of "gform_wrapper_1" while "#gform_wrapper_1" (pound) indicates that you are targeting an element with the unique ID of "gform_wrapper_1". That's not the same thing.

    If you use the # (pound) sign instead of the . (dot) it should work because that's how the markup is structured.

    If you want it to apply to all forms, you would simply use ".gform_wrapper" because that's the generic class that applies to all of the Gravity Forms on your site.

    http://css-tricks.com/818-the-difference-between-id-and-class/

    Posted 13 years ago on Thursday July 14, 2011 | Permalink
  7. dodonest
    Member

    Hey Kevin-

    Slight oversight on my part :)- Chalk it up to staring at the computer all day. I caught the "body" but overlooked the "#".

    Thanks again!

    Posted 13 years ago on Thursday July 14, 2011 | Permalink
  8. No worries. I've stared holes in my screen many times. I know how it is.. usually the simple stuff that vexes us. Glad I could help.

    Posted 13 years ago on Thursday July 14, 2011 | Permalink

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