Remove the Material Stepper header

2019-06-16 13:25发布

问题:

I want to get rid of the header navigation on the material stepper. Please suggest how can I do it? I tried setting the following css but didn't seems to work:

.mat-horizontal-stepper-header-container{display: none}

Here is stackblitz link of the stepper. https://stackblitz.com/edit/angular-material2-beta-ybbnhe?file=app%2Fapp.component.html

回答1:

You need to use a combination of ::ng-deep to get around shadow DOM and the !important flag to get around Materials own stylings:

::ng-deep .mat-horizontal-stepper-header-container {
  display: none !important;
}


回答2:

you can add this css property in <mat-horizontal-stepper #stepper> like this:

<mat-horizontal-stepper #stepper style="display: none;">
....
</mat-horizontal-stepper>