368 posts plop
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $75,000+ on Envato Market and is now an Elite Author
  • Has been part of the Envato Community for over 5 years
  • Made it to the Authors' Hall of Fame
+8 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!

368 posts plop
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $75,000+ on Envato Market and is now an Elite Author
  • Has been part of the Envato Community for over 5 years
  • Made it to the Authors' Hall of Fame
+8 more
kimonoThemes says

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

3434 posts
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $500,000+ on Envato Market
  • Located in United States
  • Helps us moderate the forums
+10 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
  • Has referred 1+ members
  • Has sold $1,000+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 10+ items on Envato Market
+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]-->
3434 posts
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $500,000+ on Envato Market
  • Located in United States
  • Helps us moderate the forums
+10 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
  • Has referred 1+ members
  • Has sold $1,000+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 10+ items on Envato Market
+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