I have the following code:
<div class="form-group">
   <div class="check-box">
      <input class="form-control input-text checkbox" data-val="true" data-val-required="The Contact Branch Specific Email field is required." id="UseBranchSpecificContact" name="UseBranchSpecificContact" type="checkbox" value="true"><input name="UseBranchSpecificContact" type="hidden" value="false">
      <label for="UseBranchSpecificContact">Contact Branch Specific Email</label>
   </div>
</div>
Which displays the following checkbox:
The checkbox is displayed using the following CSS:
.check-box label:before {
    position: absolute;
    left: 0;
    top: 2px;
    border: 1px solid #dcdde3;
    content: '';
    font-family: FontAwesome;
    line-height: 14px;
    color: #3d4964;
    font-size: 11px;
    text-align: center;
    cursor: pointer;
    display: block;
    width: 16px;
    height: 16px;
}
So the actual checkbox (input) is hidden and the above CSS adds a checkbox before the label. This is all working as expected.
I wanted to add an extra CSS class to change the color of displayed checkbox to light grey, if the label has readonly attribute. So I have added the following CSS:
.check-box label:read-only:before {
    background-color: #eeeeee;
}
But the problem is the above CSS affects the labels which do not have readonly attribute as well, I am not understanding why is that?


 
     
    