title: How to styles labels only within fieldsets using CSS?
body: <p>I have tried all the possible ways mentioned on <a href="http://www.sitepoint.com/web-foundations/css-selectors/" rel="nofollow">CSS Selectors</a>, but I have not managed to change the style of the labels that are only inside <code>fieldset</code> element. Could you please inform me what I did wrong?</p>
  
  <p><strong>View:</strong></p>
  
  <pre><code>&lt;div class="container"&gt;  
  &lt;div class="panel panel-default"&gt;
      &lt;div class="panel-body"&gt;
          &lt;div class="row"&gt;                
              &lt;div class="col-md-8 portfolio-item"&gt;
  
                  &lt;fieldset&gt;
                      &lt;legend&gt;Details&lt;/legend&gt;
  
                      &lt;div class="col-md-4 portfolio-item" &gt;                            
                          @Html.LabelFor(m =&gt; m.ID):
                          @Html.DisplayFor(m =&gt; m.ID)
                          &lt;br /&gt;
  
                          @Html.LabelFor(m =&gt; m.Name):
                          @Html.DisplayFor(m =&gt; m.Name)
                          &lt;br /&gt;
  
                          @Html.LabelFor(m =&gt; m.Surname):
                          @Html.DisplayFor(m =&gt; m.Surname)
                          &lt;br /&gt;
                      &lt;/div&gt;
  
                      &lt;div class="col-md-8 portfolio-item" &gt;
                          @Html.LabelFor(m =&gt; m.Department):
                          @Html.DisplayFor(m =&gt; m.Department)
                          &lt;br /&gt;
  
                          @Html.LabelFor(m =&gt; m.Address):
                          @Html.DisplayFor(m =&gt; m.Address)
                          &lt;br /&gt;
  
                          @Html.LabelFor(m =&gt; m.City):
                          @Html.DisplayFor(m =&gt; m.City)
                          &lt;br /&gt;
                      &lt;/div&gt;
                  &lt;/fieldset&gt;
  
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><br />
  I tried lots of different combinations of CSS Selectors in order to apply the styles only the labels inside <code>fieldset</code> elements as below:</p>
  
  <p><strong>Css:</strong></p>
  
  <pre><code>fieldset &gt; label {
          text-align: left !important;
          }
  
  fieldset + label {
          text-align: left !important;
          }
  
  div.row fieldset &gt; label {
          text-align: left !important;
          }
  </code></pre>
  
  <p>Update : Here is rendered Html code</p>
  
  <pre><code>&lt;div class="container"&gt;   
  &lt;div class="panel panel-default"&gt;
      &lt;div class="panel-body"&gt;
          &lt;div class="row"&gt;
              &lt;div class="col-md-8 portfolio-item"&gt;
  
                  &lt;fieldset&gt;
                      &lt;legend&gt;Details&lt;/legend&gt;
  
                      &lt;div class="col-md-4 portfolio-item"&gt;                            
                          &lt;label for="ID"&gt;ID&lt;/label&gt;:
                          200
                          &lt;br&gt;
  
                          &lt;label for="Name"&gt;Name&lt;/label&gt;:
                          Smith
                          &lt;br&gt;
  
                          &lt;label for="Surname"&gt;Surname&lt;/label&gt;:
                          Boyton
                          &lt;br&gt;
                      &lt;/div&gt;
  
                      &lt;!-- removed for brevity --&gt;
  
                  &lt;/fieldset&gt;                    
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>