'Set vertical scroll to a fixed height mat-table in Angular

I have set a height of 200px to the container of my mat-table. However, the table and its content does not respect the setted height. I want to add a vertical scroll to this table. enter image description here

<div style="height: 200px;">
    <mat-table>table content</mat-table>
</div>


Solution 1:[1]

Not sure if you are still looking for an answer, but just in case.

You might be missing overflow: auto; in you div styles.

Solution 2:[2]

you can set inline CSS And also you can use class and give these style properties in CSS file.

<table mat-table style="height: 500px; overflow: auto;">
// .. content
</table>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Irina Shikhman
Solution 2