Skip to content

Instantly share code, notes, and snippets.

@earlgreyxxx
Created November 1, 2020 09:45
Show Gist options
  • Save earlgreyxxx/4a83897dbf5092792508aa69fd33d635 to your computer and use it in GitHub Desktop.
Save earlgreyxxx/4a83897dbf5092792508aa69fd33d635 to your computer and use it in GitHub Desktop.
<div class="table-container">
<table>
<thead>
<tr>
<th>カラム1</th>
<th>カラム2</th>
<th>カラム3</th>
<th>カラム4</th>
<th>カラム5</th>
</tr>
</thead>
<tbody>
<tr>
<td>カラムデータ1</td>
<td>カラムデータ2</td>
<td>カラムデータ3</td>
<td>カラムデータ4</td>
<td>カラムデータ5</td>
</tr>
...
...
</tbody>
</table>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="./jquery.headerFixedTable.js"></script>
<script type="text/javascript"><!--
(function($) {
$('.table-container').headFixed();
})(jQuery);
//--></script>
<style type="text/css">
.table-container {
position: relative;
overflow: auto;
height: 100px;
width: 80%;
border: 1px solid #ccc;
}
.table-container table {
width: 100%;
border-collapse: collapse;
}
.table-container table > thead {
background-color: #eee;
}
.table-container table > thead th {
border-bottom: 2px solid #ccc !important;
}
.table-container table > tbody {
background-color: white;
}
.table-container table tr > * {
text-align: left;
border-bottom: 1px solid #ccc;
}
.table-container table > tbody > tr:last-child > * {
border-bottom: none !important;
}
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment