Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource


Babel includes JSX processing.

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


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Auto Save

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.


                <div class="docs">

<h3>Selectively displaying data</h3>

<p>The number of columns displayed in the table below depends on the available screen space, by default; a smartphone will display 2 columns, for example, while an expanded desktop browser displays the full set.  This is accomplished by assigning semantic classes to the column headings that indicate which data values take precedence (essential vs optional), in combination with media queries to display them at different screen widths (a.k.a., <a href="">responsive design</a>).</p>

<p>We added a bit of JavaScript logic so you can control which data is displayed by checking column names in the "Display" menu on the right.  Once an option is checked, the associated data will persist and display at all screen widths until the option is unchecked.</p>

<p>You can also set a column to always persist by assigning a class in the markup, in which case it has no menu option.  Here, the "Company" column is persistent.</p>


<div class="table-wrapper">

<table cellspacing="0" id="tech-companies">
         <th class="persist essential">Company</th>
         <th class="essential">Last Trade</th>
         <th class="optional">Trade Time</th>
         <th class="essential">Change</th>
         <th class="optional">Prev Close</th>
         <th class="optional">Open</th>
         <th>1y Target Est</th>
         <th>GOOG <span class="co-name">Google Inc.</span></th>
         <td>14.81 (2.54%)</td>
         <td>597.73 x 100</td>
         <td>597.91 x 300</td>
         <th>AAPL <span class="co-name">Apple Inc.</span></th>
         <td>5.74 (1.54%)</td>
         <td>378.92 x 300</td>
         <td>378.99 x 100</td>
         <th>AMZN <span class="co-name"> Inc.</span></th>
         <td>3.16 (1.68%)</td>
         <td>191.52 x 300</td>
         <td>191.58 x 100</td>
         <th>ORCL <span class="co-name">Oracle Corporation</span></th>
         <td>1.41 (4.72%)</td>
         <td>31.14 x 6500</td>
         <td>31.15 x 3200</td>
         <th>MSFT <span class="co-name">Microsoft Corporation</span></th>
         <td>0.66 (2.67%)</td>
         <td>25.50 x 71100</td>
         <td>25.51 x 17800</td>
         <th>CSCO <span class="co-name">Cisco Systems, Inc.</span></th>
         <td>0.97 (5.49%)</td>
         <td>18.65 x 10300</td>
         <td>18.66 x 24000</td>
         <th>YHOO <span class="co-name">Yahoo! Inc.</span></th>
         <td>0.11 (0.67%)</td>
         <td>15.79 x 6100</td>
         <td>15.80 x 17000</td>



                /* Styles for the tables test page */

/* Test page styles */
.docs {
   margin: 3% 5%;
   font-size: 1.2em;
.docs h3 {
   font-size: 1.2em;
   font-weight: bold;
   margin: .5em 0;
.docs p {
   margin: 0 0 1em;

body {
   font: 62.5%/1.3 Helvetica, sans-serif;
.a11y-only {
   position: absolute;
   left: -999em;

.table-wrapper {
   position: relative;
   margin: 5em 5%;
.table-menu-wrapper {
   position: absolute;
   top: -3em;
   right: 0;
.table-menu {
   position: absolute;
   background-color: #fff;
   padding: 10px;
   border: 1px solid #ccc;
   font-size: 1.2em;
   width: 12em;
   right: 0;
   left: auto;
.table-menu-hidden {
   left: -999em;
   right: auto;
.table-menu-btn {
   text-decoration: none;
   color: #333;
   font-size: 1.2em;
   background: #eee url(../_img/icon-menu.png) no-repeat 5px center;
   padding: .3em 10px .3em 20px;
   border: 1px solid #ccc;
.table-menu li {
   padding: .3em 0;

/* Table styles */
table {
	width: 100%;
	font-size: 1.2em;
thead th {
	white-space: nowrap;
	border-bottom: 1px solid #ccc;
	color: #888;
th, td {
   padding: .5em 1em;
	background-color: #fff;
	text-align: right;
td:first-child {
   text-align: left;
tbody th, td {
	border-bottom: 1px solid #e6e6e6;
.co-name {
   display: block;
   font-size: .9em;
   opacity: .4;

.enhanced th,
.enhanced td {
   display: none;

.legacy-ie .enhanced th.essential, 
.legacy-ie .enhanced td.essential {
	display: inline;
.enhanced th.essential, 
.enhanced td.essential {
   display: table-cell;

@media screen and (min-width: 500px) {
	.legacy-ie .enhanced th.optional, 
	.legacy-ie .enhanced td.optional {
		display: inline;
	.enhanced th.optional, 
	.enhanced td.optional {
		display: table-cell;

@media screen and (min-width: 800px) {
   .legacy-ie .enhanced th, 
   .legacy-ie .enhanced td {
      display: inline;
   .enhanced th, 
   .enhanced td {
      display: table-cell;


                /* Scripts for the tables test page 
   Author: Maggie Wachs,
   Date: November 2011
   Dependencies: jQuery, jQuery UI widget factory

(function( $ ) {
  $.widget( "filament.table", { // need to come up with a better namespace var...
    options: { 
      idprefix: null,   // specify a prefix for the id/headers values
      persist: null, // specify a class assigned to column headers (th) that should always be present; the script not create a checkbox for these columns
      checkContainer: null // container element where the hide/show checkboxes will be inserted; if none specified, the script creates a menu
    // Set up the widget
    _create: function() {
      var self = this,
            o = self.options,
            table = self.element,
            thead = table.find("thead"),
            tbody = table.find("tbody"),
            hdrCols = thead.find("th"),
            bodyRows = tbody.find("tr"),
            container = o.checkContainer ? $(o.checkContainer) : $('<div class="table-menu table-menu-hidden"><ul /></div>');         
      // add class for scoping styles - cells should be hidden only when JS is on
         var th = $(this),
               id = th.attr("id"), 
               classes = th.attr("class");
         // assign an id to each header, if none is in the markup
         if (!id) {
            id = ( o.idprefix ? o.idprefix : "col-" ) + i;
            th.attr("id", id);
         // assign matching "headers" attributes to the associated cells
         // TEMP - needs to be edited to accommodate colspans
            var cell = $(this).find("th, td").eq(i);                        
            cell.attr("headers", id);
            if (classes) { cell.addClass(classes); };
         // create the hide/show toggles
         if ( !"." + o.persist) ) {
	         var toggle = $('<li><input type="checkbox" name="toggle-cols" id="toggle-col-'+i+'" value="'+id+'" /> <label for="toggle-col-'+i+'">'+th.text()+'</label></li>');
	               var input = $(this), 
	                  val = input.val(), 
	                  cols = $("#" + val + ", [headers="+ val +"]");
	               if (":checked")) {; }
	               else { cols.hide(); };		
	            .bind("updateCheck", function(){
	               if ( th.css("display") == "table-cell" || th.css("display") == "inline" ) {
	                  $(this).attr("checked", true);
	               else {
	                  $(this).attr("checked", false);
      }); // end hdrCols loop 
      // update the inputs' checked status
      $(window).bind("orientationchange resize", function(){
      // if no container specified for the checkboxes, create a "Display" menu      
      if (!o.checkContainer) {
         var menuWrapper = $('<div class="table-menu-wrapper" />'),
               menuBtn = $('<a href="#" class="table-menu-btn">Display</a>');
            return false;
         // assign click-to-close event
				if ( !$( container ) && !$( container.find("*") ) ) {			
   }, // end _create
   disable: function() {
		// TBD

	enable: function() {
		// TBD
}( jQuery ) );

$(function(){ // on DOM ready

      idprefix: "co-",
      persist: "persist"

});  // end DOM ready