I have this select in angular material:
Its code :
::ng-deep works like a charm for me... for scss and sass file.
I do it this way whenever I have to remove scroll from mat-sidenav-container
.mat-sidenav-container-classname ::ng-deep mat-sidenav-content {
overflow: hidden;
}
The top solutions of /deep/
, >>>
and ::ng-deep
are being deprecated and should no longer be used.
The recommended method is now view encapsulation
Our solution to ViewEncapsulation was to override very specific css using highly specific css selectors in 1) global css or 2) creating separate style files for certain views / styles / elements, importing into every component required (e.g. styleUrls: [material-table-override.css, component.css]
).
I used ViewEncapsulation.None to successfully override material table styles within a single component in Angular 6.
On your component:
import { ViewEncapsulation } from '@angular/core';
// ...
@Component({
// ...
encapsulation: ViewEncapsulation.None,
})
Here's a great article on the subject
I was facing the same issue with Angular Material, I inspected the select element, checked its classes and tried to overwrite the css rules for material css classes , even tried !important
flag for style rules. But it was not working.
Moving all such rules from component to index.html worked for me.
.mat-select-value,
.mat-option-text,
.mat-standard-chip,
.mat-input-element,
.mat-menu-item {
color: #666 !important;
font-size: 13px !important;
}
}
The correct way to change styles of overlay classes like mat-dialog-container is to use panelClass
according to Customizing Angular Material component styles:
Add this to your global stylesheet after your theme setup
.myapp-no-padding-dialog .mat-dialog-container {
padding: 0;
}
Use the following to open the dialog
this.dialog.open(MyDialogComponent, {panelClass: 'myapp-no-padding-dialog'})
you can use:
::ng-deep {
.mat-dialog-container{
padding: 0px
}
}