I have created a new Angular CLI project and a component where I have tried work on css specificity. Wherewer I tryed, class styles overwrite tag styles, but only on Angular project it's working vise versa
I have founded that ViewEncapsulation.None makes the css styles show darkgreen backgound-color and with the angular default view encapsulation (ViewEncapsulation.Emulated) browser shows aqua background-color.
component code
import { Component, OnInit } from '@angular/core';
import {ToastrService} from "ngx-toastr";
//import {ViewEncapsulation} from "@angular/cli/lib/config/schema";
@Component({
selector: 'app-toastr',
templateUrl: './toastr.component.html',
styleUrls: ['./toastr.component.css'],
//encapsulation: ViewEncapsulation.None
})
html code
<div>
<div class="myspan">
something
</div>
</div>
and styles
div div{
background-color: aqua;
}
.myspan {
background-color: darkgreen;
}
I expect to receive an answer why it works differently