【问题标题】:Alternative to ng-deep while applying styles to a mat control将样式应用于 mat 控件时替代 ng-deep
【发布时间】:2020-09-07 17:16:07
【问题描述】:

对于带有嵌入式 iframe 的 sidenav,我得到了双滚动条, 我用

解决了这个问题
::ng-deep.mat-drawer-inner-container {
     overflow: hidden !important;
 }

这会导致其他 mat-drawer-inner-container 溢出也被隐藏。我怎样才能解决这个问题?

【问题讨论】:

  • 如果您在规则前加上:host 会怎样? :host ::ng-deep ...
  • 我试过这个 :host ::ng-deep 也隐藏了其他 mat-inner-containers
  • 创建一个重现问题的堆栈闪电战。

标签: css angular sass


【解决方案1】:

要从侧面板隐藏滚动条,您只需将以下 css 添加到您的 style.scss

.mat-drawer-inner-container::-webkit-scrollbar {
display: none;

}

请注意:如果您在侧边栏组件中使用此 CSS,它将无法正常工作!

【讨论】:

    猜你喜欢
    • 2018-01-08
    • 2018-04-11
    • 2020-05-12
    • 2018-07-26
    • 2019-08-11
    • 2018-05-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多