简体   繁体   中英

Alternative to ng-deep while applying styles to a mat control

For a sidenav with an embedded iframe, i was getting double scrollbars, I fixed that using

::ng-deep.mat-drawer-inner-container {
     overflow: hidden !important;
 }

This is now causing other mat-drawer-inner-container overflows to be hidden too. How can i fix this?

To hide the scrollbar from the side panel you just need to add the below css to your style.scss

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

}

Please Note: If you use this CSS in the sidebar component then it will not work!

add this to your style.scss without::ng-depp, so maybe you put this inside some module where you need it.

// Remove scrollbar from mat-sidenav inner container
.mat-drawer-inner-container {
  overflow: hidden !important;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM