367 posts plop
  • Elite Author
  • Sold between 50 000 and 100 000 dollars
  • Beta Tester
  • Has been a member for 5-6 years
  • Grew a moustache for the Envato Movember competition
  • Referred between 50 and 99 users
  • Interviewed on the Envato Notes blog
+3 more
kimonoThemes says

Hi,

I’m stuck with something in CSS and I can’t figured out how to do it, it would be nice you can me out :)

Here the HTML :

<form name="registerform" method="post" action="http://www.belote.com/v2/wp-login.php?action=register" id="registerform">

    <p>
        <label>Username:</label><label></label>
    </p>
    <input name="user_login" class="input" id="user_login" type="text" />
    <p></p>

    <p>
        <label>E-mail:</label>
    </p>
    <input name="user_email" class="input" id="user_email" type="text" />
    <p></p>

    <p>
        <label>Mot de passe</label><br />
        <input name="mgm_register_field[14]" size="25" class="input mgm_register_field" value="" type="password" />
    </p>

    <p>
        <label>Sexe</label><br />
        <select name="mgm_register_field[15]" class="mgm_register_field">
            <option value="Homme">Homme</option>
            <option value="Femme">Femme</option>
        </select>
    </p>

    <p>
        <input id="wp-submit" value="Register ยป" type="submit" tabindex="100" />
        <input name="redirect_to" value="http://www.belote.com/v2/inscription/" type="hidden" />
    </p>
</form>

Do you have an idea how the heck I can select the label “Sexe” in CSS to put a display:none on it without editing the HTML to add a class (I can’t edit the HTML ).

Is this possible?

Thanks for your help!

367 posts plop
  • Elite Author
  • Sold between 50 000 and 100 000 dollars
  • Beta Tester
  • Has been a member for 5-6 years
  • Grew a moustache for the Envato Movember competition
  • Referred between 50 and 99 users
  • Interviewed on the Envato Notes blog
+3 more
kimonoThemes says

Nevermind… I got it: form p:nth-of-type(6) label

3422 posts
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Community Moderator
  • Bought between 100 and 499 items
  • Referred more than 2000 users
  • Has been a member for 4-5 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
+4 more
sevenspark Volunteer moderator says

Just keep in mind that IE8 and less don’t support CSS3 Selectors, so that style will be ignored there.

http://caniuse.com/#search=nth

1148 posts
  • Referred between 1 and 9 users
  • Sold between 1 000 and 5 000 dollars
  • Has been a member for 4-5 years
  • Bought between 10 and 49 items
  • Exclusive Author
  • Envato Studio (Microlancer) Beta Tester
  • United States
fillerspace says

Just keep in mind that IE8 and less don’t support CSS3 Selectors, so that style will be ignored there.

http://caniuse.com/#search=nth

In that case, he can use a conditional comment to include jQuery to achieve the same thing in those browsers:

<!--[if lt IE 9 ]>
    <script>
        $('form p:eq(6) label').css('display':'none');
    </script>
<![endif]-->
3422 posts
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Community Moderator
  • Bought between 100 and 499 items
  • Referred more than 2000 users
  • Has been a member for 4-5 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
+4 more
sevenspark Volunteer moderator says


Just keep in mind that IE8 and less don’t support CSS3 Selectors, so that style will be ignored there.

http://caniuse.com/#search=nth

In that case, he can use a conditional comment to include jQuery to achieve the same thing in those browsers:

<!--[if lt IE 9 ]>
    <script>
        $('form p:eq(6) label').css('display':'none');
    </script>
<![endif]-->

Yup :) But if we’re talking about a javascript solution the element might as well just be removed from the DOM altogether I think. Not sure what the motivations are for removing the label in the first place.

1148 posts
  • Referred between 1 and 9 users
  • Sold between 1 000 and 5 000 dollars
  • Has been a member for 4-5 years
  • Bought between 10 and 49 items
  • Exclusive Author
  • Envato Studio (Microlancer) Beta Tester
  • United States
fillerspace says

Yup :) But if we’re talking about a javascript solution the element might as well just be removed from the DOM altogether I think. Not sure what the motivations are for removing the label in the first place.

Good point…I guess since the choices are “male” and “female”, there is no need for the label “sex”

by
by
by
by
by
by