Hello Friends,
In this article, I will explain how to solve CSS style not applying on the angular directive
In the last week, I was working with one directive where CSS style was not applying on the angular directive
Solution 1. Please add /deep/ to your CSS class
Solution 2: We should use::ng-deep instead of /deep/ which seems to be deprecated.
Usually /deep/ “shadow-piercing” combinator can be used to force a style down to child components. We have another option called::ng-deep.
since /deep/ combinator has been deprecated, it is recommended to use::ng-deep
Please find the below example. This class will be applied to child component
Example
.overview {
::ng-deep {
p {
&:last-child {
margin-bottom: 0;
}
}
}
}
Hope this helped you to solve your errorHappy Programming!!Don’t forget to leave your feedback and comments below!If you have any query mail me to Sujeet.bhujbal@gmail.comHappy programming!!Don’t forget to leave your feedback and comments below!RegardsSujeet Bhujbal--------------------------------------------------------------------------------Personal Website :-http://sujeetbhujbal.wordpress.com/CodeProject:-http://www.codeproject.com/Members/Sujit-BhujbalTwitter :-http://twitter.com/SujeetBhujbal------------------------------------------------------------------------------
No comments:
Post a Comment