【发布时间】:2018-11-13 03:23:58
【问题描述】:
我想将text-overflow: ellipsis; 应用于mat-expansion-panel 的mat-panel-description:
.mat-expansion-panel-header-description {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
width: 100%;
}
虽然溢出被隐藏,但没有省略号。看下面this stackblitz的截图:
故意阻止换行,因为我不希望描述换行到第二行。长网址也是故意的:
<mat-accordion>
<mat-expansion-panel>
<mat-expansion-panel-header>
<mat-panel-title>
Panel Title
</mat-panel-title>
<mat-panel-description>
https://stackblitz.com/edit/angular-gsxyhn?file=app%2Fexpans ion-overview-example.html
</mat-panel-description>
</mat-expansion-panel-header>
</mat-expansion-panel>
</mat-accordion>
【问题讨论】:
-
如果在元素上设置
display: inline-block;似乎可以工作(请参阅this stackblitz)。 -
您应该将渲染的标记和 css 发布上几个级别。
标签: css angular angular-material