你好,我在使用Angular 4和Bootstrap 4时遇到了问题。当我点击打开以显示日历时,它出现在我的模态框后面。 我想更改其类的z-index,但我无法访问该类,因为它是自动生成的。 如何解决这个问题? 这是我的代码。 提前致谢。
你好,我在使用Angular 4和Bootstrap 4时遇到了问题。当我点击打开以显示日历时,它出现在我的模态框后面。 我想更改其类的z-index,但我无法访问该类,因为它是自动生成的。 如何解决这个问题? 这是我的代码。 提前致谢。
z-index:1050
。.modal {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 1050;
display: none;
overflow: hidden;
-webkit-overflow-scrolling: touch;
outline: 0;
}
当创建ckd-overlay-pane
时,材料日期选择器设置z-index: 1000
.cdk-overlay-pane {
position: absolute;
pointer-events: auto;
box-sizing: border-box;
z-index: 1000;
display: flex;
max-width: 100%;
max-height: 100%;
}
You will need to include a custom class identifier to make this specific to your modal date-picker if you only want to change that one.
::ng-deep .cdk-overlay-container mat-datepicker-content{
z-index:2000;
}
::ng-deep
是可以的。
如何替换::ng-deep
.cdk-overlay-container { z-index: 1200 !important; }
::ng-deep .cdk-overlay-container { z-index:2000; }
它的作用是将一个叫做.cdk-overlay-container
的HTML元素的层级(z-index)设置为2000。 - Alex Guerreiro