I've been trying to style a BoxedComponent
style from HeaderComponent
without using ::ng-deep
, but I'm not finding a way to so properly.
The BoxedComponent
component class contains nothing different but a ViewEncapsulation.None
.
@Component({
selector: 'labs-boxed',
templateUrl: './boxed.component.html',
styleUrls: ['./boxed.component.scss'],
encapsulation: ViewEncapsulation.None,
})
export class BoxedComponent {}
HTML
<div class="boxed">
<ng-content></ng-content>
</div>
I created two classes in its SCSS file to use everywhere, but I realized I couldn't still stylize the responsiveness of the component due to the same problem.
.boxed {
/* rules */
}
.tall .boxed {
height: 500px;
width: 360px;
}
.squared .boxed {
height: 340px;
width: 340px;
}
In HeaderComponent
's HTML file, I am making use of labs-boxed
as follows:
<div id="who-we-are" class="d-flex justify-content-around">
<labs-boxed [ngClass]="'tall'">
<p>
...
...
...
So far it works, but then entering in the SCSS file, I have attempted many ways to access lab-boxed
's styles and changing it:
.boxed { ... } .tall .boxed { ...}
and so on, but without success.
How can I do it, please?