K.Z
K.Z

Reputation: 5075

Apply CSS to input type disable Checkbox

I am working on Angular 2 reactive form. I need to apply CSS when input type is disabled but I am struggling to achieve this for checkbox and radio.

HTML generated code

<input _ngcontent-c6="" type="checkbox" ng-reflect-name="01cb437e-0015-4c45-9828-fb2d1d" name="undefined" value="9b474b57-3072-4958-a265-0d74ds9abfd6" class="ng-untouched ng-pristine ng-valid">
<span _ngcontent-c6="" class="checkmark2"></span>

Following code works with input tag

span.checkmark2{
background: greenyellow;
}

Following code style doesn't work

input[type='checkbox']:disabled span.checkmark2{
 background: greenyellow;
}

Upvotes: 0

Views: 1811

Answers (1)

BeeBee8
BeeBee8

Reputation: 3074

Use sibling operator + to select the span input[type='checkbox']:disabled + span.checkmark2

Upvotes: 2

Related Questions