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


Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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


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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.




                table {
  width: 300px;
  margin: 20px auto;
  background: #fafafa;
  box-sizing: border-box;
  box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.2);

table thead {
  border: 1px solid #222;
  border-right: 0;
  background: #333;

table thead tr th {
  color: #fff;
  padding: 10px;
  border-right: 1px solid #222;

table tbody {
  border-left: 1px solid #ccc;

table tbody tr {
  border-bottom: 1px solid #ccc;

table tbody tr td {
  padding: 10px;
  border-right: 1px solid #ccc;


                var thIndex = 0,
    curThIndex = null;

  $('table thead tr th').click(function(){
    thIndex = $(this).index();
    if(thIndex != curThIndex){
      curThIndex = thIndex;
      sorting = [];
      tbodyHtml = null;
      $('table tbody tr').each(function(){
        sorting.push($(this).children('td').eq(curThIndex).html() + ', ' + $(this).index());
      sorting = sorting.sort();

function sortIt(){
  for(var sortingIndex = 0; sortingIndex < sorting.length; sortingIndex++){
  	rowId = parseInt(sorting[sortingIndex].split(', ')[1]);
  	tbodyHtml = tbodyHtml + $('table tbody tr').eq(rowId)[0].outerHTML;
  $('table tbody').html(tbodyHtml);