Before upgrading to Angular 7 and Material 7 we had a dom-structure like this:
<mat-sidenav-container>
<mat-sidenav #sidenav mode="side" [opened]="sideNavOpen">
<ul>
<li>
<a mat-icon-button color="primary" [routerLink]="['']">
<mat-icon>home</mat-icon>
</a>
</li>
...
</ul>
</mat-sidenav>
<mat-sidenav-content>
<router-outlet></router-outlet>
</mat-sidenav-content>
</mat-sidenav-container>
in the scss we had
:host {
...
> mat-toolbar {
...
}
> mat-sidenav-container {
...
> mat-sidenav {
...
> ul {
margin: 0;
padding: 0;
list-style-type: none;
...
The problem with the newer version is, that the template of mat-sidenav has changed from <ng-content></ng-content> to <div class="mat-drawer-inner-container"><ng-content></ng-content></div>.
When changing the style to
> mat-sidenav {
> div {
> ul {
margin: 0;
padding: 0;
list-style-type: none;
the style to the ul element doesn't get applied since the in the mat-sidenav doesn't get the shadow-dom _ngcontent-c0 selector. Does anyone have a solution for the style applied to the direct ancestor of this div?
ula class and style from that : not only you get rid of the library dependency, but you also a finer CSS selector, meaning your style have a higher priority. - user4676340