422 posts plop
  • Weekly Top Seller
  • Elite Author
  • Author Level 7
  • 6 Years of Membership
+9 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!

422 posts plop
  • Weekly Top Seller
  • Elite Author
  • Author Level 7
  • 6 Years of Membership
+9 more
kimonothemes
says

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

3535 posts
  • Power Elite Author
  • Author Level 12
  • Trendsetter
  • United States
+13 more
sevenspark
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

1149 posts
  • Affiliate Level 1
  • Author Level 3
  • Beta Tester
  • Collector Level 2
+3 more
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]-->
3535 posts
  • Power Elite Author
  • Author Level 12
  • Trendsetter
  • United States
+13 more
sevenspark
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.

1149 posts
  • Affiliate Level 1
  • Author Level 3
  • Beta Tester
  • Collector Level 2
+3 more
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