スクロール可能なテーブルを作成しようとしています。テーブルがHTMLで表示されないようにしたい
私が試した:
<style>
table.scroll tbody,
table.scroll thead { display: block; }
table.scroll tbody {
height: 300px;
overflow-y: auto;
overflow-x: hidden;
}
</style>
<script>
// Change the selector if needed
var $table = $('table.scroll'),
$bodyCells = $table.find('tbody tr:first').children(),
colWidth;
// Adjust the width of thead cells when window resizes
$(window).resize(function() {
// Get the tbody columns width array
colWidth = $bodyCells.map(function() {
return $(this).width();
}).get();
// Set the width of thead columns
$table.find('thead tr').children().each(function(i, v) {
$(v).width(colWidth[i]);
});
}).resize(); // Trigger resize handler
</script>
私はあなたがすべてを正しく合わせることでtbody
試しましたが、変更はありません! – MKJ
次にHTMLコードを共有する必要があります –
HTMLコードは次のとおりです。https://www.w3schools.com/code/tryit.asp?filename=FKWXSM4XT960 – MKJ