In this example below you will see how to do a tbodyだけスクロール with some HTML / CSS and Javascript

This awesome code was written by moonglows76, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright moonglows76 ©


  • HTML
  • CSS
<!DOCTYPE html>
<html lang="en" >

  <meta charset="UTF-8">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css">

      <link rel="stylesheet" href="css/style.css">



    <tr><th class="key">キー</th><th class="value">値</th></tr>
    <tr><td class="key">1</td><td class="value">aaa</td></tr>
    <tr><td class="key">2</td><td class="value">bbb</td></tr>
    <tr><td class="key">3</td><td class="value">ccc</td></tr>
    <tr><td class="key">4</td><td class="value">ddd</td></tr>
    <tr><td class="key">5</td><td class="value">eee</td></tr>
    <tr><td class="key">6</td><td class="value">fff</td></tr>
    <tr><td class="key">7</td><td class="value">ggg</td></tr>
    <tr><td class="key">8</td><td class="value">hhh</td></tr>
    <tr><td class="key">9</td><td class="value">iii</td></tr>
    <tr><td class="key">10</td><td class="value">jjj</td></tr>



/*Downloaded from https://www.codeseek.co/moonglows76/tbodyandx3060andx3051andx30b9andx30afandx30edandx30fcandx30eb-EoebVg */
table {
    border-collapse: collapse;
    border-spacing: 0;
th {
    background-color: #ccc;
th, td {
    border: 1px solid #666;
    padding: 5px;
.key, .value {
    width: 100px;
thead, tbody {
    display: block;
tbody {
    overflow-y: scroll;
    height: 150px;