1
<div class="app-component">
   <child class="test">{{name}}</child>
</div>

and my CSS styles in child class

.{
   text-align:center;
}

and i did override in parent component i.e in app component as

:host /deep/ .test{
       text-align:right;
        color: red;
     }

so in this code only "color:red" is working fine , but "text-align:right", which i want to override , is not working

Any help is appreciated i want to override the values of predefined Css and add some css also...adding CSS is working but modifying the CSS value is not working

3
  • did you try !important Commented Jul 1, 2020 at 9:38
  • yes..but it did not work Commented Jul 1, 2020 at 10:00
  • now i did again adding ! important.....it worked now...but i want to know the reason ..why it worked Commented Jul 1, 2020 at 10:02

1 Answer 1

1
:host /deep/ .test{
       text-align:right !important; 
        color: red;
     }

worked for me..

any other solution?

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.