【发布时间】:2019-05-30 01:26:47
【问题描述】:
我正在尝试制作一个通知系统,所以我正在使用来自 angular material 的mat-menu。我增加了menu-item 的宽度,但问题是它没有显示完整的内容。它只显示一行中的文本。
但如果文本超出该行,我想将文本换行,例如此处
我的compontent.html
<button mat-button [matMenuTriggerFor]="notification"><mat-icon>add_alert</mat-icon></button>
<mat-menu #notification="matMenu" [overlapTrigger]="false" class="my-full-width-menu">
<button mat-menu-item style="white-space: normal">
Learn one way to build applications with Angular and reuse your code and abilities to build
apps for any deployment target. For web, mobile web, native mobile and native desktop.
</button>
<button mat-menu-item>Item 2</button>
</mat-menu>
而CSS 是
.mat-menu-panel.my-full-width-menu {
max-width: none;
width: 100vw;
margin-left: -8px;
margin-top: 24px;
}
请告诉我该怎么做。
【问题讨论】:
-
是 css
word-break: break-word;你是什么意思? -
@RamondeVries,我试过了,但没用。
标签: javascript html css angular angular-material