I made a bootstrap table with width 150%.So obviously the table won't fit on to the screen. So I made it as both horizontal and vertical scroll-able inside a div. Now I want to fix the table header constant while scrolling down inside the div. I have checked with many articles in stack overflow and none of them works fine for me. So please don't mark it as duplicate.
Coded in VB Code IDE and angular is used
<div style="overflow-x:auto;padding: 1% 1% 1% 1%;height:calc(100vh - 236px);">
<table class="table table-striped table-responsive-md" style="font-family: 'Courier New';width:150%;">
<thead class="thead-light" style="white-space: nowrap;">
<tr>
<th scope="col">Column 1</th>
<th scope="col">Column 2</th>
<th scope="col">Column 2</th>
<th scope="col">Column 3</th>
<th scope="col">Column 4</th>
<th scope="col">Column 5</th>
<th scope="col">Column 6</th>
<th scope="col">
Column 7</th>
<th scope="col">
Column 8</th>
<th scope="col">
Column 9</th>
<th scope="col">Column 10</th>
<th scope="col">Column 11</th>
<th scope="col">Column 12</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let row of Options">
<td>Column 1</td>
<td>Column 2</td>
<td>Column 3</td>
<td>Column 4</td>
<td>Column 5</td>
<td>
<mat-form-field>
<mat-label>Column6</mat-label>
<mat-select>
<mat-option *ngFor="let option of Options" [value]="option">
{{option}}
</mat-option>
</mat-select>
</mat-form-field>
</td>
<td>
<div class="form-row">
<input placeholder="Column7">
</div>
</td>
<td>
<div class="form-row">
<mat-form-field>
<input matInput placeholder="Column 8 " type="number" >
</mat-form-field>
</div>
</td>
<td>
<div class="form-row">
<mat-form-field>
<input matInput placeholder="Column 9" type="number" >
</mat-form-field>
</div>
</td>
<td>
<div class="form-row">
<mat-form-field>
<input matInput placeholder="Column 10" type="number">
</mat-form-field>
</div>
</td>
<td>
<mat-form-field>
<mat-label>Column 11</mat-label>
<mat-select>
<mat-option *ngFor="let option of Options" [value]="option">
{{option}}
</mat-option>
</mat-select>
</mat-form-field>
</td>
<td>
<mat-form-field>
<mat-label>Column 12</mat-label>
<mat-select>
<mat-option *ngFor="let option of Options" [value]="option">
{{option}}
</mat-option>
</mat-select>
</mat-form-field>
</td>
<td>
<mat-form-field>
<mat-label>Column 13</mat-label>
<mat-select>
<mat-option *ngFor="let option of Options" [value]="option">
{{option}}
</mat-option>
</mat-select>
</mat-form-field>
</td>
</tr>
</tbody>
</table>
</div>
StackBliz Code Demo https://stackblitz.com/edit/angular-mfny4u
I expect the table header to be fixed and only the table body should scroll down