Skip to content

Instantly share code, notes, and snippets.

@ederrafo
Created September 17, 2023 19:33
Show Gist options
  • Save ederrafo/73ae9109a565de499f7f00953f5585f2 to your computer and use it in GitHub Desktop.
Save ederrafo/73ae9109a565de499f7f00953f5585f2 to your computer and use it in GitHub Desktop.
html table header fixed
<style>
table.paymentGroups tbody tr.grey th {
background-color: #ddd;
}
table.paymentGroups thead tr:first-child th {
position:sticky;
top:0px;
background: white;
z-index: 2;
}
table.paymentGroups tbody tr th {
background: white;
position: sticky;
top: 30px; /* Don't forget this, required for the stickiness */
box-shadow: 0 2px 2px -1px rgba(0, 0, 0, 0.4);
}
table.paymentGroups thead tr th {
background-color: #337ab7 !important;
border-color: #337ab7 !important;
color: #fff;
}
</style>
<table class="paymentGroups table table-striped table-bordered table-condensed">
<thead>
<tr>
<th>AccountId</th>
<th>Name</th>
<th>CustomerType</th>
<th>Total</th>
</tr>
</thead>
<tbody>
@foreach ($paymentGroups as $k => $paymentGroup)
<tr class="grey">
<th>{{ $paymentGroup['salesAgent']['code'] }}</th>
<th>{{ $paymentGroup['salesAgent']['name'] }}</th>
<th>{{ $paymentGroup['salesAgent']['email'] }}</th>
<th>{{ number_format($paymentGroup['salesAgent']['total'], 2, '.', ',') }}</th>
</tr>
@foreach ($paymentGroup['accounts'] as $account)
<tr>
<td>{{ $account['id'] }}</td>
<td>{{ $account['name'] }}</td>
<td>{{ $account['customerType'] }}</td>
<td>{{ number_format($account['total'], 2, '.', ',') }}</td>
</tr>
@endforeach
@endforeach
</tbody>
</table>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment