[英]Angular mat-menu
I want to make a big matmenu (95 items) but it goes over the page.我想做一个大的 matmenu(95 项),但它超过了页面。
see my code :看我的代码:
<mat-menu #departements="matMenu"> <button mat-menu-item (click)="choix_du_departement(01)" >01</button> <button mat-menu-item (click)="choix_du_departement(02)" >02</button> <button mat-menu-item (click)="choix_du_departement(03)">03</button> ... <button mat-menu-item (click)="choix_du_departement(95)">95</button> </mat-menu>
I tried to manage via .scss with我试图通过 .scss 进行管理
.mat-menu{ max-height: 50px; }
but nothing change但没有任何改变
I tried to modify .mat-menu-item too but some it goes off the page我也尝试修改 .mat-menu-item 但有些它不在页面上
If I understand, you need to set the height of the button如果我理解,您需要设置按钮的高度
.mat-menu-item{
max-height: 50px;
}
您有两个选择,要么为您的mat-menu
元素提供一个 mat-menu 类,要么将您的 CSS 选择器更改为mat-menu
而不是.mat-menu
我也在努力应用这个 css,而是将内容包装在一个带有自定义类的 div 中,并设置了该 div 的高度。
::ng-deep .cdk-overlay-pane {
max-height: 350px !important;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.