I need to know how it is established the precedence between ::ng-deep in angular. I have two different ::ng-deep from two different componets changing the css of the same element.
How can I give precedence to one of them? I would like to not use !important.
If you want to avoid using
!important, it is best to implement it by Selector SpecificityIllustration
Example
You just need to count how many elements, classes or IDs being referenced in your css block and compare them by their specificity as per the illustration above
Have created a Stackblitz Demo for your reference. You can omit each block off css to check their specificity samples
NOTE:
1, 0, 0 (ID)is more higher than0, 1, 3 (1 class + 3 elements)or any incremental values on those 2nd and 3rdclassto easily override styles out sinceIDhas a higher specifity than classes butclasseshas higher specifity thanelementsso you can play easily between classes and elements