220

I am facing problem while setting tbody height width overflow scroll.

<style> 
     tbody{
       height:50px;display:block;overflow:scroll
     }
   </style>

       <h3>Table B</h3>
    <table style="border: 1px solid red;width:300px;display:block">
        <thead>
            <tr>
                <td>Name</td>
                <td>phone</td>
            </tr>
        </thead>
        <tbody style='height:50px;display:block;overflow:scroll'>
            <tr>
                <td>AAAA</td>
                <td>323232</td>
            </tr>
            <tr>
                <td>BBBBB</td>
                <td>323232</td>
            </tr>
            <tr>
                <td>CCCCC</td>
                <td>3435656</td>
            </tr>
        </tbody>
    </table>

Visit my fiddle here

I want table B like Table A with overflow scroll.

Any help will be appreciated.

Many Thanks, M.

Amit Kumar
  • 3,384
  • 6
  • 25
  • 42

16 Answers16

361

If you want tbody to show a scrollbar, set its display: block;.

Set display: table; for the tr so that it keeps the behavior of a table.

To evenly spread the cells, use table-layout: fixed;.

(edit 08-2023)Disclaimer : read till the bottom of the answer. Now days, you can probably switch to a grid layout to avoid side-effects.

DEMO tbody scroll


CSS:

table, tr td {
    border: 1px solid red
}
tbody {
    display: block;
    height: 50px;
    overflow: auto;
}
thead, tbody tr {
    display: table;
    width: 100%;
    table-layout: fixed;/* even columns width , fix width of table too*/
}
thead {
    width: calc( 100% - 1em )/* scrollbar is average 1em/16px width, remove it from thead width */
}
table {
    width: 400px;
}

If tbody doesn't show a scroll, because content is less than height or max-height, set the scroll any time with: overflow-y: scroll;. DEMO 2


<editS/updateS> 2019 - 04/2021


  • Important note: this approach to making a table scrollable has drawbacks in some cases. (See comments below.) some of the duplicate answers in this thread deserves the same warning by the way

WARNING: this solution disconnects the thead and tbody cell grids; which means that in most practical cases, you will not have the cell alignment you expect from tables. Notice this solution uses a hack to keep them sort-of aligned: thead { width: calc( 100% - 1em ) }

  • Anyhow, to set a scrollbar, a display reset is needed to get rid of the table-layout (which will never show scrollbar).

  • Turning the <table> into a grid via display:grid/contents will also leave a gap in between header and scrollable part, to mind about. (idem if built from divs)

  • overflow:overlay; has not yet shown up in Firefox ( keep watching it)

  • position:sticky will require a parent container which can be the scrolling one. make sure your thead can be sticky if you have a few rows and rowspan/colspan headers in it (it does not with chrome).

So far, there is no perfect solution yet via CSS only. there is a few average ways to choose along so it fits your own table (table-layout:fixed; is .. fixing table and column's width, but javascript could probably be used to reset those values => exit pure CSS)

G-Cyrillus
  • 101,410
  • 14
  • 105
  • 129
  • 2
    GCyrillus : you are closest. But there is one issue. table width went too high. Can we fix table width? – Amit Kumar Jun 02 '14 at 08:19
  • @Maverick do you have an exemple with table width too high ? do you mean something like this ? http://jsfiddle.net/f2XYF/16/ – G-Cyrillus Jun 02 '14 at 08:24
  • 1
    Sorry, I do not have example. If we talk about code provided by you its not taking width defined in above code means: table { width:400px; } – Amit Kumar Jun 02 '14 at 08:36
  • @Maverick reset anywidth you want to table. make sure you apply CSS over a table that has no style attributes, else , the css sheet will be override by inline style. – G-Cyrillus Jun 02 '14 at 08:37
  • 3
    Thanks a lot @GCyrillus it works great ! May I suggest one tip ? Replace `overflow:auto` by `overflow-y: scroll` to avoid headers to stay 1em left even when body does not need scrollbar. – Bludwarf Oct 22 '15 at 14:11
  • 5
    Finally! I'm now able to have a fixed height, scrolling table body, fixed headers, adjustable column widths .... all without javascript! Thank you!! – Matt Hancock Dec 06 '15 at 23:13
  • 1
    With a small change in CSS: thead tr, tbody tr{ } It worked great, Thank you G-Cyr. – Vimal Raj Sep 19 '18 at 14:51
  • When `display: table` is a requirement for your design, this is by far the only working solution I could find – pattyd Feb 10 '19 at 18:23
  • 14
    WARNING: this solution disconnects the thead and tbody cell grids; which means that in most practical cases, you will not have the cell alignment you expect from tables. Notice this solution uses a hack to keep them sort-of aligned: thead { width: calc( 100% - 1em ) } – Ciabaros Sep 23 '19 at 20:45
  • @G-Cyr I call it a hack because it only estimates the width of the scrollbar, and makes one case look like the 2 grids are (sort-of) connected, but in reality they are not and will misalign in most expanded use uses. I would be wary to deploy this solution to a production UI, for ex. -- hence the warning. – Ciabaros Sep 24 '19 at 21:15
  • using javascript to comput width of columns on tbody according to the corresponding thead is something that helped me. adding some methods to handle scrollbar width and colspan soved my issue. – Sushil Thapa Sep 25 '20 at 09:06
  • Use `overflow-y: overlay;` so you can remove the `padding-right: 1em;`. Really makes everything look better. – Allart Apr 22 '21 at 13:59
  • @Allart , it would probably be a good advice for nowdays, **can you set a codepen to show us that it works fine or even add your own answer** ;) (Firefox) https://stackoverflow.com/questions/8543664/overflow-overlay-doesnt-work-in-firefox – G-Cyrillus Apr 25 '21 at 13:15
  • I have found that the CSS rule for thead `width: calc( 100% - 0.85em )` works better in Mozilla FireFox than `width: calc( 100% - 1em )`. – Hamees A. Khan Feb 08 '22 at 13:21
125

Another approach is to wrap your table in a scrollable element and set the header cells to stick to the top.

The advantage of this approach is that you don't have to change the display on tbody and you can leave it to the browser to calculate column width while keeping the header cell widths in line with the data cell column widths.

/* Set a fixed scrollable wrapper */
.tableWrap {
  height: 200px;
  border: 2px solid black;
  overflow: auto;
}
/* Set header to stick to the top of the container. */
thead tr th {
  position: sticky;
  top: 0;
}

/* If we use border,
we must use table-collapse to avoid
a slight movement of the header row */
table {
 border-collapse: collapse;
}

/* Because we must set sticky on th,
 we have to apply background styles here
 rather than on thead */
th {
  padding: 16px;
  padding-left: 15px;
  border-left: 1px dotted rgba(200, 209, 224, 0.6);
  border-bottom: 1px solid #e8e8e8;
  background: #ffc491;
  text-align: left;
  /* With border-collapse, we must use box-shadow or psuedo elements
  for the header borders */
  box-shadow: 0px 0px 0 2px #e8e8e8;
}

/* Basic Demo styling */
table {
  width: 100%;
  font-family: sans-serif;
}
table td {
  padding: 16px;
}
tbody tr {
  border-bottom: 2px solid #e8e8e8;
}
thead {
  font-weight: 500;
  color: rgba(0, 0, 0, 0.85);
}
tbody tr:hover {
  background: #e6f7ff;
}
<div class="tableWrap">
  <table>
    <thead>
      <tr>
        <th><span>Month</span></th>
        <th>
          <span>Event</span>
        </th>
        <th><span>Action</span></th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>January</td>
        <td>AAA</td>
        <td><span>Invite | Delete</span></td>
      </tr>
      <tr>
        <td>February. An extra long string.</td>
        <td>AAA</td>
        <td><span>Invite | Delete</span></td>
      </tr>
      <tr>
        <td>March</td>
        <td>AAA</td>
        <td><span>Invite | Delete</span></td>
      </tr>
      <tr>
        <td>April</td>
        <td>AAA</td>
        <td><span>Invite | Delete</span></td>
      </tr>
      <tr>
        <td>May</td>
        <td>AAA</td>
        <td><span>Invite | Delete</span></td>
      </tr>
      <tr>
        <td>June</td>
        <td>AAA</td>
        <td><span>Invite | Delete</span></td>
      </tr>
      <tr>
        <td>July</td>
        <td>AAA</td>
        <td><span>Invite | Delete</span></td>
      </tr>
      <tr>
        <td>August</td>
        <td>AAA</td>
        <td><span>Invite | Delete</span></td>
      </tr>
      <tr>
        <td>September</td>
        <td>AAA</td>
        <td><span>Invite | Delete</span></td>
      </tr>
      <tr>
        <td>October</td>
        <td>AAA</td>
        <td><span>Invite | Delete</span></td>
      </tr>
      <tr>
        <td>November</td>
        <td>AAA</td>
        <td><span>Invite | Delete</span></td>
      </tr>
      <tr>
        <td>December</td>
        <td>AAA</td>
        <td><span>Invite | Delete</span></td>
      </tr>
    </tbody>
  </table>
</div>
brandonkal
  • 1,359
  • 1
  • 8
  • 4
  • 16
    Great idea! It does not mess the table layout like the other options do. – André Aug 03 '19 at 23:39
  • 5
    Reminder to anyone else that you need to make sure no ancestor elements are using overflow. Could cause position: sticky to not work https://stackoverflow.com/questions/43707076/position-sticky-not-working-css-and-html/47878455 – cboston Dec 16 '19 at 16:32
  • Another cool aspect of this solution is that it works with `height: 100%` – Pier-Luc Gendreau Jun 22 '20 at 12:54
  • 1
    IE doesn't support position: sticky – ariel_556 Jul 30 '20 at 02:54
  • 2
    FWIW you can also add a `tfoot` with a sticky bottom position of 0 and it works like a charm. Great answer! – Matty J Aug 07 '20 at 17:36
  • Why isn't this the accepted answer ? All the other ones are doing cowboy hacks with scrollbar widths, alignment, breaking table properties... – but-why Apr 05 '21 at 11:22
  • Eventually I went for this option. Easy to implement and more maintainable. Thanks! – MikhailRatner Mar 16 '23 at 19:11
90

It is simple way to use scroll bar to table body

/* It is simple way to use scroll bar to table body*/

table tbody {
  display: block;
  max-height: 300px;
  overflow-y: scroll;
}

table thead, table tbody tr {
  display: table;
  width: 100%;
  table-layout: fixed;
}
<table>
  <thead>
    <th>Invoice Number</th>
    <th>Purchaser</th>
    <th>Invoice Amount</th>
    <th>Invoice Date</th>
  </thead>
  <tbody>
    <tr>
      <td>INV-1233</td>
      <td>Dinesh Vaitage</td>
      <td>$300</td>
      <td>01/12/2017</td>
    </tr>
    <tr>
      <td>INV-1233</td>
      <td>Dinesh Vaitage</td>
      <td>$300</td>
      <td>01/12/2017</td>
    </tr>
    <tr>
      <td>INV-1233</td>
      <td>Dinesh Vaitage</td>
      <td>$300</td>
      <td>01/12/2017</td>
    </tr>
    <tr>
      <td>INV-1233</td>
      <td>Dinesh Vaitage</td>
      <td>$300</td>
      <td>01/12/2017</td>
    </tr>
    <tr>
      <td>INV-1233</td>
      <td>Dinesh Vaitage</td>
      <td>$300</td>
      <td>01/12/2017</td>
    </tr>
    <tr>
      <td>INV-1233</td>
      <td>Dinesh Vaitage</td>
      <td>$300</td>
      <td>01/12/2017</td>
    </tr>
    <tr>
      <td>INV-1233</td>
      <td>Dinesh Vaitage</td>
      <td>$300</td>
      <td>01/12/2017</td>
    </tr>
    <tr>
      <td>INV-1233</td>
      <td>Dinesh Vaitage</td>
      <td>$300</td>
      <td>01/12/2017</td>
    </tr>
    <tr>
      <td>INV-1233</td>
      <td>Dinesh Vaitage</td>
      <td>$300</td>
      <td>01/12/2017</td>
    </tr>
    <tr>
      <td>INV-1233</td>
      <td>Dinesh Vaitage</td>
      <td>$300</td>
      <td>01/12/2017</td>
    </tr>
    <tr>
      <td>INV-1233</td>
      <td>Dinesh Vaitage</td>
      <td>$300</td>
      <td>01/12/2017</td>
    </tr>
    <tr>
      <td>INV-1233</td>
      <td>Dinesh Vaitage</td>
      <td>$300</td>
      <td>01/12/2017</td>
    </tr>
    <tr>
      <td>INV-1233</td>
      <td>Dinesh Vaitage</td>
      <td>$300</td>
      <td>01/12/2017</td>
    </tr>
    <tr>
      <td>INV-1233</td>
      <td>Dinesh Vaitage</td>
      <td>$300</td>
      <td>01/12/2017</td>
    </tr>
    <tr>
      <td>INV-1233</td>
      <td>Dinesh Vaitage</td>
      <td>$300</td>
      <td>01/12/2017</td>
    </tr>
    <tr>
      <td>INV-1233</td>
      <td>Dinesh Vaitage</td>
      <td>$300</td>
      <td>01/12/2017</td>
    </tr>
    <tr>
      <td>INV-1233</td>
      <td>Dinesh Vaitage</td>
      <td>$300</td>
      <td>01/12/2017</td>
    </tr>
    <tr>
      <td>INV-1233</td>
      <td>Dinesh Vaitage</td>
      <td>$300</td>
      <td>01/12/2017</td>
    </tr>
  </tbody>
</table>
WasiF
  • 26,101
  • 16
  • 120
  • 128
Dinesh Vaitage
  • 2,983
  • 19
  • 16
12

By default overflow does not apply to table group elements unless you give a display:block to <tbody> also you have to give a position:relative and display: block to <thead>. Check the DEMO.

.fixed {
  width:350px;
  table-layout: fixed;
  border-collapse: collapse;
}
.fixed th {
  text-decoration: underline;
}
.fixed th,
.fixed td {
  padding: 5px;
  text-align: left;
  min-width: 200px;
}


.fixed thead {
  background-color: red;
  color: #fdfdfd;
}
.fixed thead tr {
  display: block;
  position: relative;
}
.fixed tbody {
  display: block;
  overflow: auto;
  width: 100%;
  height: 100px;
  overflow-y: scroll;
    overflow-x: hidden;
}
Angel Politis
  • 10,955
  • 14
  • 48
  • 66
Kheema Pandey
  • 9,977
  • 4
  • 25
  • 26
9

Simplest of all solutions:

Add the below code in CSS:

.tableClassName tbody {
  display: block;
  max-height: 200px;
  overflow-y: scroll;
}

.tableClassName thead, .tableClassName tbody tr {
  display: table;
  width: 100%;
  table-layout: fixed;
}
.tableClassName thead {
  width: calc( 100% - 1.1em );
}

1.1 em is the average width of the scroll bar, please modify this if needed.

Gil Baggio
  • 13,019
  • 3
  • 48
  • 37
  • 1
    The syntax on the 2nd rule is incorrect, as it ends up selecting ALL `tbody tr` elements on the page. Change to: `.tableClassName thead, .tableClassName tbody tr {...}` – Aaron Hudon Nov 19 '19 at 21:29
5

Based on this answer, here's a minimal solution if you're already using Bootstrap:

div.scrollable-table-wrapper {
  height: 500px;
  overflow: auto;

  thead tr th {
    position: sticky;
    top: 0;
  }
}
<div class="scrollable-table-wrapper">
  <table class="table">
    <thead>...</thead>
    <tbody>...</tbody>
  </table>
</div>

Tested on Bootstrap v3

ErJab
  • 6,056
  • 10
  • 42
  • 54
  • Useless in IE. In other browsers, the row contents bleed through the header text while scrolling, so you'll also need to set a background-color on the to cover them up. If none of your users are on IE, this is a workable solution. – Bryan Williams Oct 12 '20 at 19:33
  • I'm using this solution with `div.scrollable-table-wrapper > table > thead tr th {...}` – Roubi Jul 14 '22 at 12:48
4

I know this is an old question but I stumbled across it when attempting to make a sticky header & footer. I found this post with a simple solution that seems to work well for what I need.

table thead,
table tfoot {
  position: sticky;
}
table thead {
  inset-block-start: 0; /* "top" */
}
table tfoot {
  inset-block-end: 0; /* "bottom" */
}
jessieloo
  • 1,759
  • 17
  • 24
3

Change your second table code like below.

<table style="border: 1px solid red;width:300px;display:block;">
<thead>
    <tr>
        <td width=150>Name</td>
        <td width=150>phone</td>
    </tr>
</thead>
<tbody style='height:50px;overflow:auto;display:block;width:317px;'>
    <tr>
        <td width=150>AAAA</td>
        <td width=150>323232</td>
    </tr>
    <tr>
        <td>BBBBB</td>
        <td>323232</td>
    </tr>
    <tr>
        <td>CCCCC</td>
        <td>3435656</td>
    </tr>
</tbody>
</table>

JSFIDDLE DEMO

Suresh Ponnukalai
  • 13,820
  • 5
  • 34
  • 54
2

In my case I wanted to have responsive table height instead of fixed height in pixels as the other answers are showing. To do that I used percentage of visible height property and overflow on div containing the table:

&__table-container {
  height: 70vh;
  overflow: scroll;
}

This way the table will expand along with the window being resized.

kazuar
  • 1,094
  • 1
  • 12
  • 14
1

HTML:

<table id="uniquetable">
    <thead>
      <tr>
        <th> {{ field[0].key }} </th>
        <th> {{ field[1].key }} </th>
        <th> {{ field[2].key }} </th>
        <th> {{ field[3].key }} </th>
      </tr>
    </thead>
    <tbody>
      <tr v-for="obj in objects" v-bind:key="obj.id">
        <td> {{ obj.id }} </td>
        <td> {{ obj.name }} </td>
        <td> {{ obj.age }} </td>
        <td> {{ obj.gender }} </td>
      </tr>
    </tbody>
</table>

CSS:

#uniquetable thead{
    display:block;
    width: 100%;
}
#uniquetable tbody{
    display:block;
    width: 100%;
    height: 100px;
    overflow-y:overlay;
    overflow-x:hidden;
}
#uniquetable tbody tr,#uniquetable thead tr{
    width: 100%;
    display:table;
}
#uniquetable tbody tr td, #uniquetable thead tr th{
   display:table-cell;
   width:20% !important;
   overflow:hidden;
}

this will work as well:

#uniquetable tbody {
    width:inherit !important;
    display:block;
    max-height: 400px;
    overflow-y:overlay;
  }
  #uniquetable thead {
    width:inherit !important;
    display:block;
  }
  #uniquetable tbody tr, #uniquetable thead tr {
    display:inline-flex;
    width:100%;
  }
  #uniquetable tbody tr td,  #uniquetable thead tr th {
    display:block;
    width:20%;
    border-top:none;
    text-overflow: ellipsis;
    overflow: hidden;
    max-height:400px;
  }
bermz kastral
  • 93
  • 2
  • 8
1

Making scrolling tables is always a challenge. This is a solution where the table is scrolled both horizontally and vertically with fixed height on tbody making theader and tbody "stick" (without display: sticky). I've added a "big" table just to show. I got inspiration from G-Cyrillus to make the tbody display:block; But when it comes to width of a cell (both in header and body), it's depending on the inside content. Therefore I added content with specific width inside each cell, both in thead and minimum first row in tbody (the other rows adapt accordingly)

.go-wrapper {
    overflow-x: auto;
    width: 100%;
}
.go-wrapper table {
    width: auto;
}
.go-wrapper table tbody {
    display: block;
    height: 220px;
    overflow: auto;
}
.go-wrapper table thead {
    display: table;
}
.go-wrapper table tfoot {
    display: table;
}
.go-wrapper table thead tr, 
.go-wrapper table tbody tr,
.go-wrapper table tfoot tr {
    display: table-row;
}

.go-wrapper table th,
.go-wrapper table td { 
    white-space: nowrap; 
}

.go-wrapper .aw-50  { min-height: 1px; width: 50px; }
.go-wrapper .aw-100 { min-height: 1px; width: 100px; }
.go-wrapper .aw-200 { min-height: 1px; width: 200px; }
.go-wrapper .aw-400 { min-height: 1px; width: 400px; }

/***** Colors *****/
.go-wrapper table {
    border: 2px solid red
}
.go-wrapper table thead, 
.go-wrapper table tbody, 
.go-wrapper table tfoot {
    outline: 1px solid green
}
.go-wrapper td {
    outline: 1px solid blue
}
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>Template</title>
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
    <link rel="stylesheet" href="css/main.css">
</head>

<body>
    <div class="container">
        <div class="row mt-5 justify-content-md-center">
            <div class="col-8">
                <div class="go-wrapper">
                    <table class="table">
                        <thead>
                            <tr>
                                <th><div class="aw-50" ><div class="checker"><span><input type="checkbox" class="styled"></span></div></div></th>
                                <th><div class="aw-200">Name</div></th>
                                <th><div class="aw-50" >Week</div></th>
                                <th><div class="aw-100">Date</div></th>
                                <th><div class="aw-100">Time</div></th>
                                <th><div class="aw-200">Project</div></th>
                                <th><div class="aw-400">Text</div></th>
                                <th><div class="aw-200">Activity</div></th>
                                <th><div class="aw-50" >Hours</th>
                                <th><div class="aw-50" >Pause</div></th>
                                <th><div class="aw-100">Status</div></th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td><div class="aw-50"><div class="checker"><span><input type="checkbox" class="styled"></span></div></div></td>
                                <td><div class="aw-200">AAAAA</div></td>
                                <td><div class="aw-50" >15</div></td>
                                <td><div class="aw-100">07.04.2020</div></td>
                                <td><div class="aw-100">10:00</div></td>
                                <td><div class="aw-200">Project 1</div></td>
                                <td><div class="aw-400">Blah blah blah</div></td>
                                <td><div class="aw-200">Activity</div></td>
                                <td><div class="aw-50" >2t</div></td>
                                <td><div class="aw-50" >30min</div></td>
                                <td><div class="aw-100">Waiting</div></td>
                            </tr>
                            <tr>
                                <td><div class="checker"><span><input type="checkbox" class="styled"></span></div></td>
                                <td>BBBBB</td>
                                <td>15</td>
                                <td>07.04.2020</td>
                                <td>10:00</td>
                                <td>Project 1</td>
                                <td>Blah blah blah</td>
                                <td>Activity</td>
                                <td>2t</td>
                                <td>30min</td>
                                <td>Waiting</td>
                            </tr>
                            <tr>
                                <td><div class="checker"><span><input type="checkbox" class="styled"></span></div></td>
                                <td>CCCCC</td>
                                <td>15</td>
                                <td>07.04.2020</td>
                                <td>10:00</td>
                                <td>Project 1</td>
                                <td>Blah blah blah Blah blah blah</td>
                                <td>Activity Activity Activity</td>
                                <td>2t</td>
                                <td>30min</td>
                                <td>Waiting</td>
                            </tr>
                            <tr>
                                <td><div class="checker"><span><input type="checkbox" class="styled"></span></div></td>
                                <td>DDDDD</td>
                                <td>15</td>
                                <td>07.04.2020</td>
                                <td>10:00</td>
                                <td>Project 1</td>
                                <td>Blah blah blah</td>
                                <td>Activity</td>
                                <td>2t</td>
                                <td>30min</td>
                                <td>Waiting</td>
                            </tr>
                            <tr>
                                <td><div class="checker"><span><input type="checkbox" class="styled"></span></div></td>
                                <td>EEEEE</td>
                                <td>15</td>
                                <td>07.04.2020</td>
                                <td>10:00</td>
                                <td>Project 1</td>
                                <td>Blah blah blah</td>
                                <td>Activity</td>
                                <td>2t</td>
                                <td>30min</td>
                                <td>Waiting</td>
                            </tr>
                            <tr>
                                <td><div class="checker"><span><input type="checkbox" class="styled"></span></div></td>
                                <td>FFFFF</td>
                                <td>15</td>
                                <td>07.04.2020</td>
                                <td>10:00</td>
                                <td>Project 1</td>
                                <td>Blah blah blah</td>
                                <td>Activity Activity Activity</td>
                                <td>2t</td>
                                <td>30min</td>
                                <td>Waiting</td>
                            </tr>
                            <tr>
                                <td><div class="checker"><span><input type="checkbox" class="styled"></span></div></td>
                                <td>GGGGG</td>
                                <td>15</td>
                                <td>07.04.2020</td>
                                <td>10:00</td>
                                <td>Project 1</td>
                                <td>Blah blah blah</td>
                                <td>Activity</td>
                                <td>2t</td>
                                <td>30min</td>
                                <td>Waiting</td>
                            </tr>
                            <tr>
                                <td><div class="checker"><span><input type="checkbox" class="styled"></span></div></td>
                                <td>HHHHH</td>
                                <td>15</td>
                                <td>07.04.2020</td>
                                <td>10:00</td>
                                <td>Project 1</td>
                                <td>Blah blah blah</td>
                                <td>Activity</td>
                                <td>2t</td>
                                <td>30min</td>
                                <td>Waiting</td>
                            </tr>
                            <tr>
                                <td><div class="checker"><span><input type="checkbox" class="styled"></span></div></td>
                                <td>IIIII</td>
                                <td>15</td>
                                <td>07.04.2020</td>
                                <td>10:00</td>
                                <td>Project 1</td>
                                <td>Blah blah blah</td>
                                <td>Activity</td>
                                <td>2t</td>
                                <td>30min</td>
                                <td>Waiting</td>
                            </tr>
                            <tr>
                                <td><div class="checker"><span><input type="checkbox" class="styled"></span></div></td>
                                <td>JJJJJ</td>
                                <td>15</td>
                                <td>07.04.2020</td>
                                <td>10:00</td>
                                <td>Project 1</td>
                                <td>Blah blah blah</td>
                                <td>Activity</td>
                                <td>2t</td>
                                <td>30min</td>
                                <td>Waiting</td>
                            </tr>
                            <tr>
                                <td><div class="checker"><span><input type="checkbox" class="styled"></span></div></td>
                                <td>KKKKK</td>
                                <td>15</td>
                                <td>07.04.2020</td>
                                <td>10:00</td>
                                <td>Project 1</td>
                                <td>Blah blah blah</td>
                                <td>Activity</td>
                                <td>2t</td>
                                <td>30min</td>
                                <td>Waiting</td>
                            </tr>
                            <tr>
                                <td><div class="checker"><span><input type="checkbox" class="styled"></span></div></td>
                                <td>LLLLL</td>
                                <td>15</td>
                                <td>07.04.2020</td>
                                <td>10:00</td>
                                <td>Project 1</td>
                                <td>Blah blah blah</td>
                                <td>Activity</td>
                                <td>2t</td>
                                <td>30min</td>
                                <td>Waiting</td>
                            </tr>
                            <tr>
                                <td><div class="checker"><span><input type="checkbox" class="styled"></span></div></td>
                                <td>MMMMM</td>
                                <td>15</td>
                                <td>07.04.2020</td>
                                <td>10:00</td>
                                <td>Project 1</td>
                                <td>Blah blah blah</td>
                                <td>Activity</td>
                                <td>2t</td>
                                <td>30min</td>
                                <td>Waiting</td>
                            </tr>
                            <tr>
                                <td><div class="checker"><span><input type="checkbox" class="styled"></span></div></td>
                                <td>NNNNN</td>
                                <td>15</td>
                                <td>07.04.2020</td>
                                <td>10:00</td>
                                <td>Project 1</td>
                                <td>Blah blah blah</td>
                                <td>Activity</td>
                                <td>2t</td>
                                <td>30min</td>
                                <td>Waiting</td>
                            </tr>
                            <tr>
                                <td><div class="checker"><span><input type="checkbox" class="styled"></span></div></td>
                                <td>OOOOO</td>
                                <td>15</td>
                                <td>07.04.2020</td>
                                <td>10:00</td>
                                <td>Project 1</td>
                                <td>Blah blah blah</td>
                                <td>Activity</td>
                                <td>2t</td>
                                <td>30min</td>
                                <td>Waiting</td>
                            </tr>
                            <tr>
                                <td><div class="checker"><span><input type="checkbox" class="styled"></span></div></td>
                                <td>PPPPP</td>
                                <td>15</td>
                                <td>07.04.2020</td>
                                <td>10:00</td>
                                <td>Project 1</td>
                                <td>Blah blah blah</td>
                                <td>Activity</td>
                                <td>2t</td>
                                <td>30min</td>
                                <td>Waiting</td>
                            </tr>
                            <tr>
                                <td><div class="checker"><span><input type="checkbox" class="styled"></span></div></td>
                                <td>QQQQQ</td>
                                <td>15</td>
                                <td>07.04.2020</td>
                                <td>10:00</td>
                                <td>Project 1</td>
                                <td>Blah blah blah</td>
                                <td>Activity</td>
                                <td>2t</td>
                                <td>30min</td>
                                <td>Waiting</td>
                            </tr>
                            <tr>
                                <td><div class="checker"><span><input type="checkbox" class="styled"></span></div></td>
                                <td>RRRRR</td>
                                <td>15</td>
                                <td>07.04.2020</td>
                                <td>10:00</td>
                                <td>Project 1</td>
                                <td>Blah blah blah</td>
                                <td>Activity</td>
                                <td>2t</td>
                                <td>30min</td>
                                <td>Waiting</td>
                            </tr>
                            <tr>
                                <td><div class="checker"><span><input type="checkbox" class="styled"></span></div></td>
                                <td>SSSSS</td>
                                <td>15</td>
                                <td>07.04.2020</td>
                                <td>10:00</td>
                                <td>Project 1</td>
                                <td>Blah blah blah</td>
                                <td>Activity</td>
                                <td>2t</td>
                                <td>30min</td>
                                <td>Waiting</td>
                            </tr>
                            <tr>
                                <td><div class="checker"><span><input type="checkbox" class="styled"></span></div></td>
                                <td>TTTTT</td>
                                <td>15</td>
                                <td>07.04.2020</td>
                                <td>10:00</td>
                                <td>Project 1</td>
                                <td>Blah blah blah</td>
                                <td>Activity</td>
                                <td>2t</td>
                                <td>30min</td>
                                <td>Waiting</td>
                            </tr>
                            <tr>
                                <td><div class="checker"><span><input type="checkbox" class="styled"></span></div></td>
                                <td>UUUUU</td>
                                <td>15</td>
                                <td>07.04.2020</td>
                                <td>10:00</td>
                                <td>Project 1</td>
                                <td>Blah blah blah</td>
                                <td>Activity</td>
                                <td>2t</td>
                                <td>30min</td>
                                <td>Waiting</td>
                            </tr>
                            <tr>
                                <td><div class="checker"><span><input type="checkbox" class="styled"></span></div></td>
                                <td>VVVVV</td>
                                <td>15</td>
                                <td>07.04.2020</td>
                                <td>10:00</td>
                                <td>Project 1</td>
                                <td>Blah blah blah</td>
                                <td>Activity</td>
                                <td>2t</td>
                                <td>30min</td>
                                <td>Waiting</td>
                            </tr>
                            <tr>
                                <td><div class="checker"><span><input type="checkbox" class="styled"></span></div></td>
                                <td>XXXXX</td>
                                <td>15</td>
                                <td>07.04.2020</td>
                                <td>10:00</td>
                                <td>Project 1</td>
                                <td>Blah blah blah</td>
                                <td>Activity</td>
                                <td>2t</td>
                                <td>30min</td>
                                <td>Waiting</td>
                            </tr>
                            <tr>
                                <td><div class="checker"><span><input type="checkbox" class="styled"></span></div></td>
                                <td>YYYYY</td>
                                <td>15</td>
                                <td>07.04.2020</td>
                                <td>10:00</td>
                                <td>Project 1</td>
                                <td>Blah blah blah</td>
                                <td>Activity</td>
                                <td>2t</td>
                                <td>30min</td>
                                <td>Waiting</td>
                            </tr>
                            <tr>
                                <td><div class="checker"><span><input type="checkbox" class="styled"></span></div></td>
                                <td>ZZZZZ</td>
                                <td>15</td>
                                <td>07.04.2020</td>
                                <td>10:00</td>
                                <td>Project 1</td>
                                <td>Blah blah blah</td>
                                <td>Activity</td>
                                <td>2t</td>
                                <td>30min</td>
                                <td>Waiting</td>
                            </tr>
                            <tr>
                                <td><div class="checker"><span><input type="checkbox" class="styled"></span></div></td>
                                <td>ÆÆÆÆÆ</td>
                                <td>15</td>
                                <td>07.04.2020</td>
                                <td>10:00</td>
                                <td>Project 1</td>
                                <td>Blah blah blah</td>
                                <td>Activity</td>
                                <td>2t</td>
                                <td>30min</td>
                                <td>Waiting</td>
                            </tr>
                            <tr>
                                <td><div class="checker"><span><input type="checkbox" class="styled"></span></div></td>
                                <td>ØØØØØ</td>
                                <td>15</td>
                                <td>07.04.2020</td>
                                <td>10:00</td>
                                <td>Project 1</td>
                                <td>Blah blah blah</td>
                                <td>Activity</td>
                                <td>2t</td>
                                <td>30min</td>
                                <td>Waiting</td>
                            </tr>
                            <tr>
                                <td><div class="checker"><span><input type="checkbox" class="styled"></span></div></td>
                                <td>ÅÅÅÅÅ</td>
                                <td>15</td>
                                <td>07.04.2020</td>
                                <td>10:00</td>
                                <td>Project 1</td>
                                <td>Blah blah blah</td>
                                <td>Activity</td>
                                <td>2t</td>
                                <td>30min</td>
                                <td>Waiting</td>
                            </tr>
                        </tbody>
                        <tfoot>
                            <tr>
                                <th><div class="aw-50" ><div class="checker"><span><input type="checkbox" class="styled"></span></div></div></th>
                                <th><div class="aw-200">Name</div></th>
                                <th><div class="aw-50" >Week</div></th>
                                <th><div class="aw-100">Date</div></th>
                                <th><div class="aw-100">Time</div></th>
                                <th><div class="aw-200">Project</div></th>
                                <th><div class="aw-400">Text</div></th>
                                <th><div class="aw-200">Activity</div></th>
                                <th><div class="aw-50" >Hours</th>
                                <th><div class="aw-50" >Pause</div></th>
                                <th><div class="aw-100">Status</div></th>
                            </tr>
                        </tfoot>
                    </table>
                </div>
            </div>
        </div>
    </div>
   
    <script src="https://code.jquery.com/jquery-3.4.1.slim.min.js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script>
</body>

</html>
1

I was looking for the same solution for my project. This is how I did it.
The data is taken from one of the answers above for demonstration purpose.

.tableContainer {
  max-height: 150px;
  overflow-y: scroll;
  padding: 0;
  margin: 0;
  border: 1px solid black;
  width: 100%;
}

table {
  width: 100%;
}

thead {
  position: sticky;
  top: 0px;
  background-color: white;
}


/* for styling only */

td {
  border: 1px solid black;
}
<div class="tableContainer">
  <table>
    <thead>
      <th>Invoice Number</th>
      <th>Purchaser</th>
      <th>Invoice Amount</th>
      <th>Invoice Date</th>
    </thead>
    <tbody>
      <tr>
        <td>INV-1233</td>
        <td>Dinesh Vaitage</td>
        <td>$300</td>
        <td>01/12/2017</td>
      </tr>
      <tr>
        <td>INV-1233</td>
        <td>Dinesh Vaitage</td>
        <td>$300</td>
        <td>01/12/2017</td>
      </tr>
      <tr>
        <td>INV-1233</td>
        <td>Dinesh Vaitage</td>
        <td>$300</td>
        <td>01/12/2017</td>
      </tr>
      <tr>
        <td>INV-1233</td>
        <td>Dinesh Vaitage</td>
        <td>$300</td>
        <td>01/12/2017</td>
      </tr>
      <tr>
        <td>INV-1233</td>
        <td>Dinesh Vaitage</td>
        <td>$300</td>
        <td>01/12/2017</td>
      </tr>
      <tr>
        <td>INV-1233</td>
        <td>Dinesh Vaitage</td>
        <td>$300</td>
        <td>01/12/2017</td>
      </tr>
      <tr>
        <td>INV-1233</td>
        <td>Dinesh Vaitage</td>
        <td>$300</td>
        <td>01/12/2017</td>
      </tr>
      <tr>
        <td>INV-1233</td>
        <td>Dinesh Vaitage</td>
        <td>$300</td>
        <td>01/12/2017</td>
      </tr>
      <tr>
        <td>INV-1233</td>
        <td>Dinesh Vaitage</td>
        <td>$300</td>
        <td>01/12/2017</td>
      </tr>
      <tr>
        <td>INV-1233</td>
        <td>Dinesh Vaitage</td>
        <td>$300</td>
        <td>01/12/2017</td>
      </tr>
      <tr>
        <td>INV-1233</td>
        <td>Dinesh Vaitage</td>
        <td>$300</td>
        <td>01/12/2017</td>
      </tr>
      <tr>
        <td>INV-1233</td>
        <td>Dinesh Vaitage</td>
        <td>$300</td>
        <td>01/12/2017</td>
      </tr>
      <tr>
        <td>INV-1233</td>
        <td>Dinesh Vaitage</td>
        <td>$300</td>
        <td>01/12/2017</td>
      </tr>
      <tr>
        <td>INV-1233</td>
        <td>Dinesh Vaitage</td>
        <td>$300</td>
        <td>01/12/2017</td>
      </tr>
      <tr>
        <td>INV-1233</td>
        <td>Dinesh Vaitage</td>
        <td>$300</td>
        <td>01/12/2017</td>
      </tr>
      <tr>
        <td>INV-1233</td>
        <td>Dinesh Vaitage</td>
        <td>$300</td>
        <td>01/12/2017</td>
      </tr>
      <tr>
        <td>INV-1233</td>
        <td>Dinesh Vaitage</td>
        <td>$300</td>
        <td>01/12/2017</td>
      </tr>
      <tr>
        <td>INV-1233</td>
        <td>Dinesh Vaitage</td>
        <td>$300</td>
        <td>01/12/2017</td>
      </tr>
    </tbody>
  </table>

</div>
theLearner
  • 35
  • 5
0

I guess what you're trying to do, is to keep the header fixed and to scroll the body content. You can scroll the content into 2 directions:

  • horizontally: you won't be able to scroll the content horizontally unless you use a slider (a jQuery slider for example). I would recommend to avoid using a table in this case.
  • vertically: you won't be able to achieve that with a tbody tag, because assigning display:block or display:inline-block will break the layout of the table.

Here's a solution using divs: JSFiddle

HTML:

<div class="wrap_header">
    <div class="column">
        Name
    </div>
    <div class="column">
        Phone
    </div>
    <div class="clearfix"></div>
</div>
<div class="wrap_body">
    <div class="sliding_wrapper">
        <div class="serie">
            <div class="cell">
                AAAAAA
            </div>
            <div class="cell">
                323232
            </div>
            <div class="clearfix"></div>
        </div>
        <div class="serie">
            <div class="cell">
                BBBBBB
            </div>
            <div class="cell">
                323232
            </div>
            <div class="clearfix"></div>
        </div>
        <div class="serie">
            <div class="cell">
                CCCCCC
            </div>
            <div class="cell">
                3435656
            </div>
            <div class="clearfix"></div>
        </div>
    </div>
</div>

CSS:

.wrap_header{width:204px;}
.sliding_wrapper,
.wrap_body {width:221px;}
.sliding_wrapper {overflow-y:scroll; overflow-x:none;}
.sliding_wrapper,
.wrap_body {height:45px;}
.wrap_header,
.wrap_body {overflow:hidden;}
.column {width:100px; float:left; border:1px solid red;}
.cell {width:100px; float:left; border:1px solid red;}

/**
 * @info Clearfix: clear all the floated elements
 */
.clearfix:after {
    visibility:hidden;
    display:block;
    font-size:0;
    content:" ";
    clear:both;
    height:0;
}
.clearfix {display:inline-table;}

/**
 * @hack Display the Clearfix as a block element
 * @hackfor Every browser except IE for Macintosh
 */
    /* Hides from IE-mac \*/
    * html .clearfix {height:1%;}
    .clearfix {display:block;}
    /* End hide from IE-mac */

Explanation:

You have a sliding wrapper which will contain all the data.

Note the following:

.wrap_header{width:204px;}
.sliding_wrapper,
.wrap_body {width:221px;}

There's a difference of 17px because we need to take into consideration the width of the scrollbar.

Wissam El-Kik
  • 2,469
  • 1
  • 17
  • 21
0

Webkit seems to use internally display: table-row-group for the tbody tag. There is currently a bug with setting height to it: https://github.com/w3c/csswg-drafts/issues/476

Let's hope it will be solved soon.

Karl Adler
  • 15,780
  • 10
  • 70
  • 88
0

Just found a cool solution using grid! This is what I used and it worked out perfectly:

tbody tr, thead tr {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr; // or whatever division you wanna do
}

tbody {
  height: 300px; // or whatever height
  width: 100%;
  overflow-y: auto;
  display: block;
}

Demo: https://codesandbox.io/s/table-with-inner-body-scroll-hggq7x

avivyar
  • 31
  • 4
-1

Here is a good example for table scrolling across x and y way. Horizontal and vertical scrolling is the best thing for responsive table.

table, th, tr, td {
  border: 1px solid lightgrey;
  border-collapse: collapse;
  
}
tbody {
  max-height: 200px;
max-width: 200px;
  overflow: auto;
  display: block;
  table-layout: fixed;
}

tr {
  display: table;
}
<table>
  <thead>
      <tr>
    <th>1</th>
    <th>2</th>
    <th>3</th>
  </tr>
  </thead>
  <tbody>
      <tr>
    <th>
     <input type="checkbox"> 
  </th>
    <td>2</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
  </tr>
    <tr>
    <th>
     <input type="checkbox"> 
  </th>
    <td>2</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
  </tr>
    <tr>
    <th>
     <input type="checkbox"> 
  </th>
    <td>2</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
  </tr>
    <tr>
    <th>
     <input type="checkbox"> 
  </th>
    <td>2</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
  </tr>
    <tr>
    <th>
     <input type="checkbox"> 
  </th>
    <td>2</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
  </tr>
    <tr>
    <th>
     <input type="checkbox"> 
  </th>
    <td>2</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
  </tr>
    <tr>
    <th>
     <input type="checkbox"> 
  </th>
    <td>2</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
  </tr>
    <tr>
    <th>
     <input type="checkbox"> 
  </th>
    <td>2</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
  </tr>
    <tr>
    <th>
     <input type="checkbox"> 
  </th>
    <td>2</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
  </tr>
    <tr>
    <th>
     <input type="checkbox"> 
  </th>
    <td>2</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
  </tr>
    <tr>
    <th>
     <input type="checkbox"> 
  </th>
    <td>2</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
  </tr>
    <tr>
    <th>
     <input type="checkbox"> 
  </th>
    <td>2</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>

    <td>3</td>
  </tr>
    <tr>
    <th>
     <input type="checkbox"> 
  </th>
    <td>2</td>
    <td>3</td>
  </tr>
    <tr>
    <th>
     <input type="checkbox"> 
  </th>
    <td>2</td>
    <td>3</td>
  </tr>
    <tr>
    <th>
     <input type="checkbox"> 
  </th>
    <td>2</td>
    <td>3</td>
  </tr>
  </tbody>
</table>