sarius
sarius

Reputation: 177

How to avoid overlapping of text in Angulars <mat-list>

I have a problem with the < mat-list > and the associated < mat-list-item > of Angular. Namely the text which is in < mat-list-item > overlaps the texts of the other items in case of e.g. a small width of the < mat-list > or when resizing the browser window.

My question now is: what adjustments do I have to make (probably in the CSS) so that the text just expands downwards like in a < div >.

Thanks in advance, if any info is missing, please let me know!

With < mat-list >:

Mat-List

<mat-list>
    <mat-list-item>This is a very long text to check for overlapping. This is a very long text to check for overlapping. This is a very long text to check for overlapping.</mat-list-item>
    <mat-list-item>This is a very long text to check for overlapping. This is a very long text to check for overlapping. This is a very long text to check for overlapping.</mat-list-item>
    <mat-list-item>This is a very long text to check for overlapping. This is a very long text to check for overlapping. This is a very long text to check for overlapping.</mat-list-item>
</mat-list>

With < div >:

enter image description here

<div>
    This is a very long text to check for overlapping. This is a very long text to check for overlapping. This is a very long text to check for overlapping. This is a very long text to check for overlapping.
</div>

Upvotes: 0

Views: 974

Answers (1)

sarius
sarius

Reputation: 177

The answer was to set the height of the < mat-list > to "auto" with "!important".

.wrapper {
  height: auto !important;
}

Upvotes: 1

Related Questions