cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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.

            
              <div id="Description">
  
</div>
<table class="table">
  <thead>
    <tr>
      <th>
        <!-- Text Heading Example -->
        Col Heading 1
      </th>
      <th>
        <!-- Empty Heading Example -->
      </th>
      <th>
        <!-- Heading with html example -->
        <div>Col Heading 3</div>
      </th>
      <th>
        <!-- Button Heading Example -->
        <button class="btn">Col Heading 4</button>
      </th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Col 1</td>
      <td>Col 2</td>
      <td>Col 3</td>
      <td>Col 4</td>
    </tr>
    <tr>
      <td>Col 1</td>
      <td>Col 2</td>
      <td>Col 3</td>
      <td>Col 4</td>
    </tr>
    <tr>
      <td>Col 1</td>
      <td>Col 2</td>
      <td>Col 3</td>
      <td>Col 4</td>
    </tr>
  </tbody>
</table>
<div id="message"></div>
            
          
!
            
              body {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 100%;
}
#message {
  background: #eee;
  margin-top:20px;
  padding: 5px 20px 20px 20px;
  -webkit-box-shadow: inset 0px 0px 5px 3px rgba(50, 50, 50, 0.75);
  -moz-box-shadow:    inset 0px 0px 5px 3px rgba(50, 50, 50, 0.75);
box-shadow:         inset 0px 0px 5px 3px rgba(50, 50, 50, 0.75);
  border-radius: 3px 3px 3px 3px;
  -moz-border-radius: 3px 3px 3px 3px;
  -webkit-border-radius: 3px 3px 3px 3px;
}
.hidden-large {display:none;}

/* 
Generic Styling, for Desktops/Laptops 
*/
table { 
  width: 100%; 
  border-collapse: collapse;
  -webkit-box-shadow: 0px 0px 3px 3px rgba(50, 50, 50, 0.5);
-moz-box-shadow:    0px 0px 3px 3px rgba(50, 50, 50, 0.5);
box-shadow:         0px 0px 3px 3px rgba(50, 50, 50, 0.5);
  border-radius: 3px 3px 3px 3px;
-moz-border-radius: 3px 3px 3px 3px;
-webkit-border-radius: 3px 3px 3px 3px;
}
/* Zebra striping */
tr:nth-of-type(even) { 
  background: #f9fcf7;
background: -moz-linear-gradient(top,  #f9fcf7 0%, #f5f9f0 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f9fcf7), color-stop(100%,#f5f9f0));
background: -webkit-linear-gradient(top,  #f9fcf7 0%,#f5f9f0 100%);
background: -o-linear-gradient(top,  #f9fcf7 0%,#f5f9f0 100%);
background: -ms-linear-gradient(top,  #f9fcf7 0%,#f5f9f0 100%);
background: linear-gradient(to bottom,  #f9fcf7 0%,#f5f9f0 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f9fcf7', endColorstr='#f5f9f0',GradientType=0 ); 
}
tr:hover {
  background: rgb(255, 204, 36);
  background: rgba(255, 204, 36, 0.6);
}
th { 
  background: #e2e2e2;
  background: -webkit-linear-gradient(#e2e2e2 0%, #dbdbdb 50%, #d1d1d1 51%, #fefefe 100%);
  background: -moz-linear-gradient(#e2e2e2 0%, #dbdbdb 50%, #d1d1d1 51%, #fefefe 100%);
  background: -o-linear-gradient(#e2e2e2 0%, #dbdbdb 50%, #d1d1d1 51%, #fefefe 100%);
  background: linear-gradient(#e2e2e2 0%, #dbdbdb 50%, #d1d1d1 51%, #fefefe 100%);
  filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#e2e2e2', endColorstr='#fefefe',GradientType=0 );
  text-shadow: 0px -1px 0px rgba(255, 255, 255, 1);
  color: #3e3e3e; 
  font-weight: bold; 
}
td, th { 
  padding: 6px; 
  border: 1px solid #ccc; 
  text-align: left; 
}
td:hover {
  -webkit-box-shadow: 0px 0px 3px 3px rgba(50, 50, 50, 0.2);
  -moz-box-shadow:    0px 0px 3px 3px rgba(50, 50, 50, 0.2);
  box-shadow:         0px 0px 3px 3px rgba(50, 50, 50, 0.2);
}
.btn:focus {
  background: #ffcc24;
  text-decoration:none;
}
.btn, .btn:visited {
  background: #ffcc24;
  background-image: -webkit-linear-gradient(top, #ffcc24, #cca31e);
  background-image: -moz-linear-gradient(top, #ffcc24, #cca31e);
  background-image: -ms-linear-gradient(top, #ffcc24, #cca31e);
  background-image: -o-linear-gradient(top, #ffcc24, #cca31e);
  background-image: linear-gradient(to bottom, #ffcc24, #cca31e);
  -webkit-border-radius: 3;
  -moz-border-radius: 3;
  border-radius: 3px;
  font-family: Arial;
  color: #ffffff;
  font-size: 20px;
  padding: 10px 20px 10px 20px;
  text-decoration: none;
  border:none;
}

.btn:hover {
  background: #d6b136;
  background-image: -webkit-linear-gradient(top, #d6b136, #ffcc24);
  background-image: -moz-linear-gradient(top, #d6b136, #ffcc24);
  background-image: -ms-linear-gradient(top, #d6b136, #ffcc24);
  background-image: -o-linear-gradient(top, #d6b136, #ffcc24);
  background-image: linear-gradient(to bottom, #d6b136, #ffcc24);
  text-decoration: none;
}

@media only screen and (max-width: 760px) {

	/* Force table to not be like tables anymore */
	table, thead, tbody, th, td, tr { 
		display: block; 
	}
	
	table { 
  width: auto;
  min-width:320px;
  }
	
	/* Hide table headers (but not display: none;, for accessibility) */
	thead tr { 
		position: absolute;
		top: -9999px;
		left: -9999px;
	}
	
	tr { border: 1px solid #ccc; }
	
	td { 
		/* Behave  like a "row" */
		border: none;
		border-bottom: 1px solid #eee; 
		position: relative;
	}
	.hidden-large {
    min-width:150px !important;
    margin-right:10px;
    padding-right:30px;
    display:inline-block;
  }
}
            
          
!
            
              $(function() {
  //map TH content to an array
  var columnHeaders = $("table.table thead tr th").map(function() {
      return $(this).html();
    }).get(),
    count = 0;
  
  //output array into corresponding TD
  $("table.table tbody tr td").each(function() {
    if (!columnHeaders[count]) {
      $(this).prepend('<span class="hidden-large">' + columnHeaders[count] + '</span>');
    } else {
      $(this).prepend('<span class="hidden-large">' + columnHeaders[count] + '</span>');
    }
    count++;
    if (count == columnHeaders.length) {
      count = 0;
    }
  });

  //message script added for debugging. Can be removed.		
  $("#message").html("<h2>Table headings grabbed by the script</h2>columnHeaders: " + columnHeaders.length + "<br />This is the dynamic array of column headers<br /> [ " + columnHeaders + " ]<br />");
});
            
          
!
999px
🕑 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.
Loading ..................

Console