How to configure div using css class or scss?

May I know how to set css class to div? I tried as below, but fail, and it works if I set style=“color:red” in the div elements.

html code:

  <div style="color:red" *ngIf="'required') &&">* Email is required!</div>
  <div class="alertmsg" *ngIf="'invalidEmailAddress')
      &&">* Invalid Email Address!</div>


.test {
alertmsg {
color: red;


missed dot.


I tried to put dot, but still failed to set the alert message font color to red

You nested your .alertmsg class, so I assume you wrapped the entire content in a div/content block with .test as class?