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.

Best practice to target a label...

  1. Just want to make sure I'm doing this right. If I wanted to target a label for a field, is this the best way to get it done:

    body #gform_wrapper_1 label.gfield_label {
    color: #ffffff;
    }

    TIA
    Biagio

    Posted 13 years ago on Saturday November 27, 2010 | Permalink
  2. That will target all of the labels with the class "gfield_label" for form ID#1. If that's what you want to do, then you're golden.

    If you only want to target one specific label, it would be like this

    body #gform_wrapper_1 li#field_1_1 label.gfield_label {color:#fff}

    that only applies the rule to the label that's contained in the "field_1_1" list item. Of course, you would replace the "field_1_1" with the actual ID from your form.

    Posted 13 years ago on Saturday November 27, 2010 | Permalink
  3. Thanks so much...I almost have it. My only question I still have is about

    li#field_1_1

    Where exactly am I looking to know that it's 1_1 ... is that because if there was another field it woudl be 1_2, since it would be the second 1 on the page? And I assume the first "1" indicates the form number?

    Thanks so much!

    Posted 13 years ago on Sunday November 28, 2010 | Permalink
  4. The best way to find it is to simply view the source and get the ID from the parent <li > element.

    http://grab.by/7BJP

    Yes, the first number is the form ID# and the second is the field ID. The ID's are added when you add them to the editor, but if you re-arrange the order in the editor, the ID's won't be in sequential order in the form output. It's always best to give a quick look and make sure you have the correct ID - saves a lot of headaches.

    Posted 13 years ago on Sunday November 28, 2010 | Permalink