将CSS应用于div的第一个标签

ham*_*437 4 css css-selectors

我想将特定的CSS应用于我的HTML中的特定标签,这是我的HTML

<div id="registration">
    <div>
        <label>Localisation</label>**//this is the target label to apply css** 
        <div id="registration_localisation">
            <div>
                <label>Gouvernorat</label>
                <select id="registration_localisation_gouvernorat">
                  <option value="1">Ariana</option>
                  <option value="2">Ben Arous</option>
                  <option value="3">Bizerte</option>
               </select>
                </div>
                 <div>
                <label for="registration_localisation_ville">Ville</label>
                <input type="text" id="registration_localisation_ville">
                 </div>
               </div>
         </div>
         <div>
        <label>Annonceur</label>**//this is the target label to apply the css** 
        <div id="registration_annonceur">
            <div>
                <label for="registration_annonceur_Nom">Nom</label>
                <input type="text" id="registration_annonceur_Nom">
            </div>
            <div>
                <label for="registration_annonceur_Email">Email</label>
                <input type="text" id="registration_annonceur_Email">
            </div>
            <div>
                <label for="registration_Telephone" >Telephone</label>
                <input type="text" id="registration_annonceur_Telephone">
            </div>
        </div>
         </div>

</div>
Run Code Online (Sandbox Code Playgroud)

我使用了很多伪类,但我没有找到任何解决方案吗?

Ale*_*eri 11

尝试这种方式,您可以在包含的div中设置所有标签的样式 registration

#registration > div > label{
   //your css
}
Run Code Online (Sandbox Code Playgroud)

DEMO