<div class="tbl">
<div class="table-area">
<table class="responsive-table table">
<thead>
<tr>
<th><input type="checkbox"> First name</th>
<th>Last name</th>
<th>Points</th>
<th>Content</th>
</tr>
</thead>
<tbody>
<tr>
<td><input type="checkbox"> Jill</td>
<td>Smith</td>
<td>50</td>
<td>Lorem Ipsum is simply dummy text of the printing and typesetting industry. </td>
</tr>
<tr>
<td><input type="checkbox"> Eve</td>
<td>Jackson</td>
<td>94</td>
<td>Lorem Ipsum has been the industry's standard dummy text ever since the 1500s</td>
</tr>
<tr>
<td><input type="checkbox"> Jill</td>
<td>Smith</td>
<td>50</td>
<td>Lorem Ipsum is simply dummy text of the printing and typesetting industry. </td>
</tr>
<tr>
<td><input type="checkbox"> Eve</td>
<td>Jackson</td>
<td>94</td>
<td>Lorem Ipsum has been the industry's standard dummy text ever since the 1500s</td>
</tr>
<tr>
<td><input type="checkbox"> Jill</td>
<td>Smith</td>
<td>50</td>
<td>Lorem Ipsum is simply dummy text of the printing and typesetting industry. </td>
</tr>
<tr>
<td><input type="checkbox"> Eve</td>
<td>Jackson</td>
<td>94</td>
<td>Lorem Ipsum has been the industry's standard dummy text ever since the 1500s</td>
</tr>
<tr>
<td><input type="checkbox"> Jill</td>
<td>Smith</td>
<td>50</td>
<td>Lorem Ipsum is simply dummy text of the printing and typesetting industry. </td>
</tr>
<tr>
<td><input type="checkbox"> Eve</td>
<td>Jackson</td>
<td>94</td>
<td>Lorem Ipsum has been the industry's standard...
CSS
body{
margin: 0;
}
.tbl{
padding: 20px;
}
.table-area {
height: 300px;
position: relative;
z-index: 0;
overflow-y: auto;
}
table.responsive-table {
display: table;
/* required for table-layout to be used (not normally necessary; included for completeness) */
table-layout: fixed;
/* this keeps your columns with fixed with exactly the right width */
width: 100%;
/* table must have width set for fixed layout to work as expected */
height: 100%;
}
table.responsive-table thead {
position: fixed;
top: 0;
left: 0;
right: 0;
width: 100%;
height: 50px;
line-height: 3em;
background: #eee;
table-layout: fixed;
display: table;
}
table.responsive-table th {
background: #eee;
margin: 20px;
}
table.responsive-table td {
line-height: 2em;
}
table.responsive-table tr > td,
table.responsive-table th {
text-align: left;
}
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.