'Overflow property for table with sticky header rows

I tried implementing a table/mat-accordion combination as shown in the stackblitz link provided below. My intention was to keep the mat-accordion's "mat-expansion-panel-header" and the table header with sticky display (same as shown in the link) but since "overflow" can't be set in the parent element for "position: sticky" to work in the < th >s, it's my table which is determining the width of my entire html ( and my navbar {which is given for reference} and other elements/components use the view port, making them shorter ). And if I add "overflow" to the table, I can't have the "sticky" effect.

Is there any way I could make the table scrollable for x direction, with the effects intact (just as it would behave with an overflow applied on the table) ?

It would be really helpful if someone could give a solution with pure CSS. Thanks.

Please find the link here:

https://stackblitz.com/edit/angular-expansion-panel-toggle-header-6ehsz7?file=app/expansion-overview-example.html



Sources

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

Source: Stack Overflow

Solution Source