title: CSS Selector for label bound to input
body: <p>Is there a way in CSS to select <code>label</code>s bound to <code>input</code> fields (via the <code>for</code> attribute) having the <code>required</code> attribute set? Something like:</p>
  
  <pre><code>label:input[required] {
    ...
  }
  </code></pre>
  
  <p>Currently, I'm adding <code>class="required"</code> to labels and inputs for styling. I now have the HTML5 attribute <code>required="required"</code> in the required input fields. It would be nice to remove the redundant class attributes.</p>
  
  <p>The <a href="https://stackoverflow.com/questions/1431726/css-selector-for-a-checked-radio-buttons-label">closest answer</a> I found doesn't use the <code>label</code> element's <code>for</code> attribute, but would require that the <code>label</code> be directly adjacent to the input in the HTML.</p>