Reputation: 19288
I'm trying to get text-overflow: ellipsis
on the text of a checkbox. How would I do that?
https://stackblitz.com/edit/angular-a7tmmp
Upvotes: 5
Views: 1827
Reputation: 5395
You can also add text-overflow to .mat-checkbox-layout
, like:
.mat-checkbox-layout {
white-space: no-wrap;
overflow: hidden;
text-overflow: ellipsis;
display: block;
width: 200px
}
Can wrap this in ::ng-deep {}
to skip encapsulation when you're in a component. For example to target .mat-checkbox-layout
in your current component and child dom:
:host {
::ng-deep {
.mat-checkbox-layout {
...
}
}
}
Upvotes: 1
Reputation: 68
Add width
property to your checkbox. The text-overflow
property specifies how overflowed content should be displayed. Since the width is not set (even for its parent elements), the text of checkbox keeps extending without overflow.
See this where I added the width
property to one of the checkbox:
https://stackblitz.com/edit/angular-a7tmmp-ix64hc
Upvotes: 2