/* my.component.scss */ :host { display: block; background: red; }
/* my.component.scss */ :host-context(.red) { background: red; }
// app.component.scss .first { color: yellowgreen; } ::ng-deep .second { color: deeppink; }
<!-- inner component html --> <h2>My inner</h2> <p class="first">p in inner, class first</p> <p class="second">2nd p in inner, class second</p>
with global color styles
add some font size component styles
add another component with different color
// app.component.ts
import {Component, ViewEncapsulation} from '@angular/core';
@Component({
selector: 'my-app',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
encapsulation: ViewEncapsulation.None
})
export class AppComponent {
}