I don’t want to write a second-time label selector. How can I merge both CSS?
Don’t apply padding-right for the .mat-checkbox selector.
label, .mat-checkbox .mat-checkbox-layout .mat-checkbox-label {
color: #5b5b5b !important;
font-weight: 600 !important;
}
label {
padding-right: 1em;
}
I have tried but not working. Anyone can provide solution?
label, .mat-checkbox .mat-checkbox-layout .mat-checkbox-label {
color: #5b5b5b !important;
font-weight: 600 !important;
& {
padding-right: 1em;
}
}
2
Answers
If
.mat-checkbox .mat-checkbox-layout .mat-checkbox-label
is also a<label>
, you could try something like this.This is not possible.
Your first rule applies to "all" elements, and its child rules can not apply to a single parent element.
You implemented it the best way possible IMO.
This document could be a good starting Point for learning scss:
https://gist.github.com/fredsiika/2958726da1f94a9bd447f4f7bd03a852