Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

      <th data-type="numeric">ID <span class="resize-handle"></span></th>
      <th data-type="text-short">First name <span class="resize-handle"></span></th>
      <th data-type="text-short">Last name <span class="resize-handle"></span></th>
      <th data-type="text-short">Email <span class="resize-handle"></span></th>
      <th data-type="text-long">Street <span class="resize-handle"></span></th>
      <th data-type="text-short">Country <span class="resize-handle"></span></th>
      <th data-type="text-long">University <span class="resize-handle"></span></th>
      <th data-type="text-short">IBAN <span class="resize-handle"></span></th>
      <td>7850 Old Shore Drive</td>
      <td>United Kingdom</td>
      <td>University of Plymouth</td>
      <td>BG34 MPVP 8782 88EX H1CJ SC</td>
      <td>245 Merchant Circle</td>
      <td>South East European University</td>
      <td>FR11 4824 2942 41H9 XBHC 46P2 O86</td>
      <td>70700 Kipling Pass</td>
      <td>Instituto Superior Novas Profissões - INP</td>
      <td>GR96 7559 456P GUAN WTAJ 3VPB S0P</td>
      <td>03 Service Terrace</td>
      <td>Epoka University</td>
      <td>LI59 1813 2T7T VKTO 6RKE X</td>
      <td>9 Eliot Parkway</td>
      <td>Universitas Mahasaraswati Denpasar</td>
      <td>BR27 4570 4226 4255 5239 0197 316T J</td>
      <td>03418 Ludington Plaza</td>
      <td>Federal University of Technology, Minna</td>
      <td>ES45 6721 1332 3288 6455 1242</td>
      <td>7932 Sloan Park</td>
      <td>Saint Ferdinand College</td>
      <td>GB50 HFAD 8121 3729 9841 31</td>
      <td>2 Schurz Junction</td>
      <td>Xi'an University of Electronic Science and Technology</td>
      <td>KZ85 7422 XDPB P2VQ H8SR</td>
      <td>055 Mockingbird Way</td>
      <td>St. Petersburg State Mining Institute (Technical University)</td>
      <td>CH61 6423 9T4W WP0I 8MUK C</td>
      <td>74 David Pass</td>
      <td>Instituto Politécnico de Setúbal</td>
      <td>ES71 2390 0665 1601 8072 4924</td>
      <td>4237 Moulton Park</td>
      <td>Chongqing University of Science and Technology </td>
      <td>BE21 5598 4355 8287</td>
      <td>20 Westridge Crossing</td>
      <td>University of lloilo</td>
      <td>SI71 6487 6088 3774 839</td>
      <td>46 Sherman Avenue</td>
      <td>Punjab Institute of Computer science</td>
      <td>FO47 9031 2293 0020 12</td>
      <td>40 Sunnyside Lane</td>
      <td>South Africa</td>
      <td>University of South Africa</td>
      <td>FR23 5330 9279 24NB IC4T ZDH9 I74</td>
      <td>18570 Starling Pass</td>
      <td>Politeknik Negeri Sambas</td>
      <td>LU79 248V TPNJ ZQHZ 0S4Q</td>
      <td>1440 Cherokee Place</td>
      <td>Shenyang Pharmaceutical University</td>
      <td>GT19 CZJ0 WH8Y 4WI8 JPQJ AWNY TYF9</td>
      <td>46597 Sunnyside Crossing</td>
      <td>Mälardalen University</td>
      <td>RS38 2407 6062 1886 8447 80</td>
      <td>611 Hanover Point</td>
      <td>New Zealand</td>
      <td>Christchurch Polytechnic Institute of Technology</td>
      <td>BH30 ZRXH ODUV MOSX OFZO C0</td>
      <td>De witt</td>
      <td>3183 Cascade Drive</td>
      <td>Institut Teknologi Bandung</td>
      <td>BA49 4027 6071 7896 3508</td>
      <td>5712 Drewry Avenue</td>
      <td>Shanghai University</td>
      <td>FR20 7714 6817 4685 SEL2 YP0U M08</td>
      <td>97 Fallview Junction</td>
      <td>Université de Technologie de Compiègne</td>
      <td>FR70 3203 5174 02S6 6KGU YIJ7 866</td>
      <td>1 Judy Court</td>
      <td>United States</td>
      <td>St. John's College New Mexico</td>
      <td>TR88 6812 9R3F KLQV 7UGW 6KUC ZK</td>
      <td>02 Delaware Place</td>
      <td>Universitas Sumatera Utara</td>
      <td>RO39 QWVG UTYY DFHP GLXN 5AVB</td>
      <td>087 Blue Bill Park Parkway</td>
      <td>Philippine Normal University</td>
      <td>FR13 5171 4360 67VL SKC2 7JV1 T98</td>
      <td>39757 Forest Run Trail</td>
      <td>Zhejiang Forestry University</td>
      <td>GT50 CAYK CCAK 8N5Y GATX GDC7 BLKX</td>
      <td>Le Barr</td>
      <td>966 Manley Pass</td>
      <td>Belarussian State Academy of Music</td>
      <td>AE57 4203 4302 6701 7034 464</td>
      <td>14 Cottonwood Place</td>
      <td>Academy of Sports and Physical Training</td>
      <td>FR58 9328 1950 57IO EKDB XT4E W01</td>
      <td>29 Crescent Oaks Parkway</td>
      <td>Universitas Mataram</td>
      <td>MC82 1239 0144 47DG K10R PJ7C D13</td>
      <td>6115 Paget Park</td>
      <td>Universidad Autónoma del Paraguay</td>
      <td>GR17 5976 8180 FEAA G6Y6 AU1S 7I5</td>
      <td>979 Center Pass</td>
      <td>Federal College Of Education (Technical), Akoka</td>
      <td>FO61 3603 8098 3978 26</td>
      <td>666 Gulseth Point</td>
      <td>Soutsaka Institute of management and Technology</td>
      <td>FR70 3298 4193 27RN N42L JAV5 P71</td>
      <td>266 Kennedy Drive</td>
      <td>China Pharmaceutical University Nanjing</td>
      <td>VG64 UBHK 0733 7572 3779 1044</td>
      <td>5 Raven Drive</td>
      <td>University of Italian Studies for Foreigners of Perugia</td>
      <td>BR74 1721 1313 2909 4374 0106 458L H</td>
      <td>664 Grim Drive</td>
      <td>Université de Limoges</td>
      <td>FR66 0658 0047 76P6 NO5B FD5B E53</td>
      <td>9451 Saint Paul Hill</td>
      <td>Burkina Faso</td>
      <td>Université de Ouagadougou</td>
      <td>MT40 PUPM 0146 6FZY TMGU OXV6 YVMG PNG</td>
      <td>098 Luster Place</td>
      <td>Manuel L. Quezon University</td>
      <td>IS37 2792 3576 2239 0080 0929 97</td>
      <td>383 Westerfield Crossing</td>
      <td>Czech Republic</td>
      <td>Mendel University of Agriculture and Forestry</td>
      <td>PS12 DQYK HUW1 WGJL TKWG NN5Z 1E0B K</td>
      <td>598 Heath Trail</td>
      <td>Al Muthanna University</td>
      <td>MR88 0301 9435 2450 6678 0618 446</td>
      <td>36329 Kensington Trail</td>
      <td>University of Windsor</td>
      <td>FR57 8680 5195 87XH VVMU G86M L60</td>
      <td>526 Vahlen Crossing</td>
      <td>Belarussian State University of Informatics and Radioelectronics</td>
      <td>FO76 2813 6080 9783 71</td>
      <td>98 Spenser Way</td>
      <td>Acdemic Center for Law and Business</td>
      <td>PK58 YJYC LWTY BWDZ 7TYD 8DBS</td>
      <td>7 Mccormick Alley</td>
      <td>Instituto Politécnico de Tomar</td>
      <td>FR31 7659 0600 133Q NER3 L5EX P10</td>
      <td>1 Center Point</td>
      <td>Crimea State Medical University</td>
      <td>AZ18 GKKM FI8V 2GTE YGPZ PHMR LIZH</td>
      <td>41 Warrior Avenue</td>
      <td>Ishinomaki Senshu University</td>
      <td>KZ85 378H ZVED RXYB 4BQW</td>
      <td>7 Utah Circle</td>
      <td>Ecole Supérieure de Commerce de Toulouse</td>
      <td>FR06 0107 1068 96OI 8LVV 6SO8 I86</td>
      <td>69 Brickson Park Terrace</td>
      <td>Université de Lomé</td>
      <td>FR18 2064 4825 32HG QKHB OSVQ 210</td>
      <td>69044 Esch Hill</td>
      <td>Volgograd Medical Academy</td>
      <td>FI59 2922 4654 2674 93</td>
      <td>O' Connell</td>
      <td>41372 Hagan Road</td>
      <td>El Salvador</td>
      <td>Universidad Técnica Latinoamericana</td>
      <td>FO32 5579 3550 3940 56</td>
      <td>5 Twin Pines Plaza</td>
      <td>Université d'Antananarivo</td>
      <td>RO25 QNQO HRXQ WNXP XRLJ PULO</td>
      <td>98 Scofield Avenue</td>
      <td>Zhejiang Gongshang University</td>
      <td>RS67 3228 8155 5103 0069 22</td>
      <td>86512 Luster Trail</td>
      <td>Universitas Kediri</td>
      <td>TR76 0439 4C2H 5Y2S 6ZHZ 0IFO SG</td>
      <td>174 Corben Pass</td>
      <td>Universitas Tidar Magelang</td>
      <td>MC91 0055 2801 70PQ CJ1A IWY2 Z77</td>
      <td>0 Basil Street</td>
      <td>Universitas Indonusa Esa Unggul</td>
      <td>LB27 0627 EDRT 2KSD 4EDC LQSY 171Z</td>
      <td>115 Farwell Road</td>
      <td>Omsk State Pedagogical University</td>
      <td>NO80 2696 3735 396</td>
      <td>1 Northview Circle</td>
      <td>United States</td>
      <td>National College of Naturopathic Medicine</td>
      <td>AT04 5217 0257 5678 6498</td>
      <td>5723 Alpine Pass</td>
      <td>Hoshi University</td>
      <td>LT11 3360 3556 1669 6079</td>
      <td>078 Nobel Circle</td>
      <td>Shinshu University</td>
      <td>AT68 1262 2864 7227 7864</td>
      <td>3004 Tomscot Way</td>
      <td>Kursk State Medical University</td>
      <td>FR43 5588 7450 03N0 EUB2 JGC6 E48</td>
      <td>59 2nd Court</td>
      <td>Universitas Jayabaya</td>
      <td>SA39 32WK VTJ9 BILO GESP VFX2</td>
      <td>57885 Hudson Place</td>
      <td>Tomsk State University of Control Systems and Radioelectronics</td>
      <td>MT30 PNHV 4276 5H0X 7AGN R62T VGBQ T1J</td>
      <td>4 Glacier Hill Parkway</td>
      <td>Technical University of Lodz</td>
      <td>CH08 9910 27TS KGDI 47VI 7</td>
      <td>39 Bay Hill</td>
      <td>Mount Allison University</td>
      <td>FR02 1304 2863 40WK SDPD PUHG S70</td>
      <td>276 Bunker Hill Road</td>
      <td>University of Victoria</td>
      <td>LI89 6102 0QYQ K0J7 B6KH E</td>
      <td>9 Prairieview Junction</td>
      <td>United States</td>
      <td>Baptist Bible College of Pennsylvania</td>
      <td>LV10 FSJG OU3S KYSX LVJI E</td>
      <td>541 Spaight Road</td>
      <td>Volgograd State University of Architecture and Civil Engineering (VolgGASU)</td>
      <td>IS41 3056 7152 7476 6808 0819 29</td>
      <td>29 Eliot Place</td>
      <td>University of the East, Coloocan</td>
      <td>KZ23 7664 JFOZ W5SS 4DG2</td>
      <td>215 Russell Court</td>
      <td>Tokyo Gakugei University</td>
      <td>LU48 706B MFNK OEPN FBTQ</td>
      <td>49 Killdeer Trail</td>
      <td>Kemerovo State University</td>
      <td>FR30 6212 1519 25TZ DUBU EZOJ Y06</td>
      <td>56 Chive Lane</td>
      <td>Universitas Putera Batam</td>
      <td>PT06 5208 0281 5407 7419 0491 1</td>
      <td>Zum Felde</td>
      <td>767 Lyons Park</td>
      <td>Vitebsk State Medical University</td>
      <td>IE09 PMDL 0852 7020 9037 94</td>
      <td>826 Warner Pass</td>
      <td>Chengdu University of Technology</td>
      <td>IT38 X742 3487 765J F9AQ 5DTP LXB</td>
      <td>67 Mccormick Place</td>
      <td>Agricultural University of Tirane</td>
      <td>GI13 SWEY HZRF H032 PPC4 IIN</td>
      <td>46899 3rd Park</td>
      <td>FPT University</td>
      <td>ES87 7017 1997 4643 0740 3181</td>
      <td>8692 Roth Terrace</td>
      <td>Shanxi University</td>
      <td>AZ46 LMAB 17CO A0FE BVR3 SGIU 1AAT</td>
      <td>4176 Fallview Drive</td>
      <td>Webster University, Thailand</td>
      <td>FR52 0417 1752 51WT AENP 8TOR L31</td>
      <td>95 Lake View Circle</td>
      <td>European Academy of Arts in Warsaw</td>
      <td>MT25 WXMB 7091 81VN FMRT YNM2 I70B BNS</td>
      <td>20 Superior Road</td>
      <td>Vaganova Academy of Russian Ballet</td>
      <td>CH12 9538 9QIN Q8EV F4P6 S</td>
      <td>3791 Rieder Trail</td>
      <td>Fundación Universitaria del Area Andina. Sede Pereira</td>
      <td>SK37 7152 6293 3100 7282 4066</td>
      <td>21191 Grasskamp Way</td>
      <td>Southwest University of Science and Technology</td>
      <td>MC80 0705 3276 31WU 8W0V TIEH 597</td>
      <td>9002 Carioca Lane</td>
      <td>Universidade Metodista de Piracicaba</td>
      <td>GT07 PFFC IX4L 2L6X 9FBO U8FH 8P10</td>
      <td>2633 Glendale Junction</td>
      <td>Kazan State Academy of Architecture and Civil Engineering</td>
      <td>BG25 CPTO 9300 01ZQ QKZR QC</td>
      <td>5174 Packers Court</td>
      <td>Instituto Superior de Gestão - ISG</td>
      <td>SM40 Z439 3471 551X 2LQF XPAZ CIM</td>
      <td>4696 Fisk Center</td>
      <td>Institut Teknologi Bandung</td>
      <td>MD81 RJ5E WP8P 3X2X R70Q PAS2</td>
      <td>855 Warbler Road</td>
      <td>Hellenic Army Academy</td>
      <td>PS52 CANZ ZJWI KB60 I58U ALNE FBWK H</td>
      <td>69821 Beilfuss Terrace</td>
      <td>Université des Antilles et de la Guyane</td>
      <td>SE14 4415 8768 0025 6257 4953</td>
      <td>97 Luster Street</td>
      <td>Universidad José Maria Vargas</td>
      <td>AT52 3410 8243 4120 6922</td>
      <td>51231 Russell Center</td>
      <td>Xi'an Jiaotong University</td>
      <td>SK32 0734 4505 2565 0951 4548</td>
      <td>82338 1st Hill</td>
      <td>Universidad del Valle del Cauca</td>
      <td>CY52 5878 8878 NN29 VLZO VK0Z 6DPY</td>
      <td>62431 Hudson Parkway</td>
      <td>Czech Republic</td>
      <td>University of Education Hradec Kralove</td>
      <td>FI61 8982 0476 9940 56</td>
      <td>2 Veith Center</td>
      <td>Universitas Kristen Petra</td>
      <td>CR10 2128 8657 0621 6271 9</td>
      <td>4 Fairview Park</td>
      <td>Jingdezhen China Institute</td>
      <td>FR73 6513 3899 53TZ YRFC VTBB K98</td>
      <td>3856 Kim Trail</td>
      <td>Sumy State University</td>
      <td>FR43 2472 2037 70QS PT7A XCPM J01</td>
      <td>29010 Mosinee Plaza</td>
      <td>International Hellenic University</td>
      <td>565 Merrick Place</td>
      <td>University College of Borås</td>
      <td>IT95 S608 3151 3104 AOQU W5OX WNC</td>
      <td>436 Katie Junction</td>
      <td>Universiti Tenaga Nasional</td>
      <td>MC83 5681 3920 91DX Z5QE 5DW1 K64</td>
      <td>903 Blackbird Center</td>
      <td>Stockholm Institute of Education</td>
      <td>CH87 6031 3UVI HUWJ LYNX 5</td>
      <td>92129 Debs Avenue</td>
      <td>United States</td>
      <td>Adler School of Professional Psychology</td>
      <td>LU95 683P 3RT0 MDNH ITYS</td>
      <td>2987 Prairieview Avenue</td>
      <td>Mälardalen University</td>
      <td>AD82 2183 2056 OJWZ GYIF ARLV</td>
      <td>50 Melody Plaza</td>
      <td>National University of Uzbekistan</td>
      <td>FR66 4433 2587 202T TVCH MREV D83</td>
      <td>866 Summerview Point</td>
      <td>United States</td>
      <td>Jarvis Christian College</td>
      <td>FR52 8407 9410 570M BBLX EZFH 092</td>
              * {
  box-sizing: border-box;

body {
  padding: 0;
  margin: 0;

body {
  font-family: BlinkMacSystemFont, -apple-system, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", "Helvetica", "Arial", sans-serif;

table {
  min-width: 100vw;
  width: auto;
  flex: 1;
  display: grid;
  border-collapse: collapse;
  /* These are just initial values which are overriden using JavaScript when a column is resized */
    minmax(150px, 1fr)
    minmax(150px, 1.67fr)
    minmax(150px, 1.67fr)
    minmax(150px, 1.67fr)
    minmax(150px, 3.33fr)
    minmax(150px, 1.67fr)
    minmax(150px, 3.33fr)
    minmax(150px, 1.67fr);

tr {
  display: contents;

td {
  padding: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;

th {
  position: sticky;
  top: 0;
  background: #6c7ae0;
  text-align: left;
  font-weight: normal;
  font-size: 1.1rem;
  color: white;
  position: relative;

th:last-child {
  border: 0;

.resize-handle {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  background: black;
  opacity: 0;
  width: 3px;
  cursor: col-resize;

/* The following selector is needed so the handle is visible during resize even if the mouse isn't over the handle anymore */
.header--being-resized .resize-handle {
  opacity: 0.5;

th:hover .resize-handle {
  opacity: 0.3;

td {
  padding-top: 10px;
  padding-bottom: 10px;
  color: #808080;

tr:nth-child(even) td {
  background: #f8f6ff;
              // Our real web app uses Vue.js but I'll stick to plain JavaScript here

const min = 150;
// The max (fr) values for grid-template-columns
const columnTypeToRatioMap = {
  numeric: 1,
  'text-short': 1.67,
  'text-long': 3.33,

const table = document.querySelector('table');
  The following will soon be filled with column objects containing
  the header element and their size value for grid-template-columns 
const columns = [];
let headerBeingResized;

// The next three functions are mouse event callbacks

// Where the magic happens. I.e. when they're actually resizing
const onMouseMove = (e) => requestAnimationFrame(() => {
  // Calculate the desired width
  horizontalScrollOffset = document.documentElement.scrollLeft;
  const width = (horizontalScrollOffset + e.clientX) - headerBeingResized.offsetLeft;
  // Update the column object with the new size value
  const column = columns.find(({ header }) => header === headerBeingResized);
  column.size = Math.max(min, width) + 'px'; // Enforce our minimum
  // For the other headers which don't have a set width, fix it to their computed width
  columns.forEach((column) => {
    if(column.size.startsWith('minmax')){ // isn't fixed yet (it would be a pixel value otherwise)
      column.size = parseInt(column.header.clientWidth, 10) + 'px';
    Update the column sizes
    Reminder: grid-template-columns sets the width for all columns in one value
  table.style.gridTemplateColumns = columns
    .map(({ header, size }) => size)
    .join(' ');

// Clean up event listeners, classes, etc.
const onMouseUp = () => {
  window.removeEventListener('mousemove', onMouseMove);
  window.removeEventListener('mouseup', onMouseUp);
  headerBeingResized = null;

// Get ready, they're about to resize
const initResize = ({ target }) => {
  headerBeingResized = target.parentNode;
  window.addEventListener('mousemove', onMouseMove);
  window.addEventListener('mouseup', onMouseUp);

// Let's populate that columns array and add listeners to the resize handles
document.querySelectorAll('th').forEach((header) => {
  const max = columnTypeToRatioMap[header.dataset.type] + 'fr';
    // The initial size value for grid-template-columns:
    size: `minmax(${min}px, ${max})`,
  header.querySelector('.resize-handle').addEventListener('mousedown', initResize);
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.