CSSでヘッダを固定したスクロールテーブルを作る方法を紹介します。 1.はじめに 次のようなHTMLでテーブルを作成しました。 <style> table { border-collapse: collapse; border-spacing: 0; } th { background-color: #ccc; } th, td { border: 1px solid #666; padding: 5px; } .key, .value { width: 100px; } </style> <table> <thead> <tr><th class="key">キー</th><th class="value">値</th></tr> </thead> <tbody> <tr><td class="key">1</td><td class="value">aaa</td></tr> <tr>
![CSSでヘッダを固定したスクロールテーブルを作る方法](https://cdn-ak-scissors.b.st-hatena.com/image/square/a7a40ae04400f8ce1d140a72f143e03cb2ae1d96/height=288;version=1;width=512/https%3A%2F%2Fwww.koikikukan.com%2Fimages%2F2015%2F01%2F20150114_css_1.png)