/*
By David Rueter ([email protected]) 2/18/2014
Derived from answer by giulio posted on https://stackoverflow.com/questions/21168521/scrollable-table-with-fixed-header-in-bootstrap with example at http://jsfiddle.net/T9Bhm/7/
Modified to use child selectors (instead of decendent selectors) so that nested tables do not cause problems. Also simplified by removing some unnecessary CSS.
Assumes we are using Bootstrap 3, and that the table has a class of "table". If either of these are not the case, you must add the following to the CSS:
table.fixedHead {
width: 100%
}
Additional Bootstrap table classes may be added without any problems (table-condensed, table-striped, etc.)
Notes:
1) Height of the <thead> must be explicitly provided. The .fixedHead class provides a default / placeholder
2) Width of each column must be explicitly provided--both for the <th> and the first row of <td> nodes. The .fixedHead class provides defaults / placeholders.
3) If a value is omitted from a <th>, you must provide a in lieu of the value--or else explicitly specify the height of the <tr>
*/
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.