Sandy Albaytar Jr. Sandy Albaytar Jr. - 1 year ago 59
CSS Question

display:none not working - probably wrong element targeted

I need to set a honeypot section of a side form to

but for some reason my CSS adjustments would not work. The elements involved are these (as shown when inspected via Firebug):

<li id="field_9_9" class="gfield gform_validation_container field_sublabel_below field_description_below">
<label class="gfield_label" for="input_9_9">Phone</label>
<div class="ginput_container">
<input id="input_9_9" type="text" value="" name="input_9">
<div class="gfield_description">This field is for validation purposes and should be left unchanged.</div>

On the stylesheet, I inserted:

.gfield gform_validation_container field_sublabel_below field_description_below #field_9_9 {

I have a feeling I'm targeting the wrong element. Which one should it be?

Answer Source

You need to do this:

#field_9_9.gfield.gform_validation_container.field_sublabel_below.field_description_below {

You forgot to add the "." before each class name and since all the classes (and ID) are on the same element, you need to join all the classes and ID together.

But a more elegant solution would be to simply target the ID:

#field_9_9 {
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download