Changing style of overlay container
UPDATED ANSWER
From the official documentation:
Styling overlay components
Overlay-based components have a panelClass property (or similar) that can be used to target the overlay pane.
You can override the default dialog container styles by adding a css class in your global styles.css
. For example:
.custom-dialog-container .mat-dialog-container {
/* add your styles */
}
After that, you'll need to providies you css class as a panelClass
parameter to your dialog:
this.dialog.open(MyDialogComponent, { panelClass: 'custom-dialog-container' })
Read this official documentation for more information.
ORIGINAL ANSWER
Use ::ng-deep
in your component.css to override the default styles.
::ng-deep .cdk-overlay-container {
/* Do you changes here */
position: fixed;
z-index: 1000;
}
If you want to change the styling of mat-dialogue-container adding a panel class and giving style is enough, but in case if you want to change the styling of cdk-overlay-container then adding a backdropClass will help
const dialogRef = this.dialog.open(PopupComponent, {
backdropClass: 'popupBackdropClass',
panelClass: 'custom-dialog-container',
data: { data: data }
});
in css add
.popupBackdropClass {
background-color:yellow
}