toggling styles on label (active/focus) for input field with css only
问题 Wondering whether if there is a css-only way to perform to toggle styles on the corresponding label on input's focus. So far I have: $(document).on('focus active', 'input',function(){ $('label[for='+$(this).attr('id')+']').addClass('active'); }); $(document).on('blur', 'input',function(){ $('label[for='+$(this).attr('id')+']').removeClass('active'); }); HTML: <div class="row"> <label for="contact_form_mail">Email</label> <input id="contact_form_mail" name="contact_form_mail" type="email"