大佬教程收集整理的这篇文章主要介绍了css – md-menu覆盖Angular 2中的默认最大宽度,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
<img src="/assets/images/ic-notifications.png" [mdMenutriggerFor]="appMenu"/> <md-menu #appMenu="mdMenu" [overlaptrigger]="false" yPosition="below" xPosition="before" class="notifications-dropdown"> <button md-menu-item > <div class="row notification-row"> <div> <span class="image-container"> Option 1 </span> </div> </div> </button> </md-menu>
在CSS文件中,我这样做:
.mat-menu-panel.notifications-dropdown { max-width:none; width: 100vw; margin-left: -8px; margin-top: 24px; overflow: visible; } .notification-row{ width: 424px; }
在控制台中,我可以识别设置默认值的类:max-width:280px;,当我在我的控制台中编辑它时,它工作得很好,但即使我尝试在我的CSS代码中覆盖它,我也无法做到这一点.我试过这个,还:
.mat-menu-panel{ max-width: 600px; }
还有这个:
.cdk-overlay-container .mat-menu-panel{ max-width:600px; width: 100vw; margin-left: -8px; margin-top: 24px; }
如何覆盖此默认值?
@Component({ templateUrl: './my.component.html',styleUrls: ['./my.component.css'],encapsulation: ViewEncapsulation.None,})
然后在您的组件css中,您可以完全按照您的尝试进行操作:
.mat-menu-panel.notifications-dropdown { max-width:none; width: 100vw; margin-left: -8px; margin-top: 24px; overflow: visible; } .notification-row{ width: 424px; }
以上是大佬教程为你收集整理的css – md-menu覆盖Angular 2中的默认最大宽度全部内容,希望文章能够帮你解决css – md-menu覆盖Angular 2中的默认最大宽度所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。