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="form.controls.email.hasError('required') && loginForm.controls.email.touched">* Email is required!</div>
  <div class="alertmsg" *ngIf="form.controls.email.hasError('invalidEmailAddress')
      && form.controls.email.touched">* Invalid Email Address!</div>

scss:

.test {
alertmsg {
color: red;
}
}

Result:
image

missed dot.

.alertmsg

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?