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.


  <h1>Table Rows with Different Display Properties</h1>
    For this example, individual rows are set to whatever <code>display</code> property you choose, which breaks the entire table structure. To demonstrate, the buttons below converts all but the header rows to whichever style you press.
    Note that only the first row (of data, not the header row) has ARIA properties set. These properties will retain semantics for all but <code>display: contents</code>, but can do nothing for the layout.
    <button onclick="ToggleRowDisplay('block',this);">Convert rows to <code>block</code>.</button>
    <button onclick="ToggleRowDisplay('inline',this);">Convert rows to <code>inline</code>.</button>
    <button onclick="ToggleRowDisplay('contents',this);">Convert rows to <code>contents</code>.</button>
    <button onclick="ToggleRowDisplay('table-row',this);">Reset rows to <code>table-row</code>.</button>
  <div role="region" aria-labelledby="Cap1" tabindex="0" id="TableContainer">
    <table id="Books" role="table">
      <caption id="Cap1">Books I May or May Not Have Read</caption>
        <tr role="row">
          <th role="columnheader">Author</th>
          <th role="columnheader">Title</th>
          <th role="columnheader">Year</th>
          <th role="columnheader">ISBN-13</th>
          <th role="columnheader">ISBN-10</th>
        <tr role="row">
          <td role="cell">Miguel De Cervantes</td>
          <td role="cell">The Ingenious Gentleman Don Quixote of La Mancha</td>
          <td role="cell">1605</td>
          <td role="cell">9783125798502</td>
          <td role="cell">3125798507</td>
          <td>Mary Shelley</td>
          <td>Frankenstein; or, The Modern Prometheus</td>
          <td>Herman Melville</td>
          <td>Moby-Dick; or, The Whale</td>
          <td>Emma Dorothy Eliza Nevitte Southworth</td>
          <td>The Hidden Hand</td>
          <td>F. Scott Fitzgerald</td>
          <td>The Great Gatsby</td>
          <td>George Orwell</td>
          <td>Nineteen Eighty-Four</td>
    This pen is used in the post <cite><a href="">Layout as a Clue to Semantics</a></cite>.


                @import url(",400i,700");

body {
  background-color: #6d695c;
  font-size: 100%;
  color: #333;
  font-family: Lato, Arial, sans-serif;
  padding: 0;
  margin: 0;

main {
  display: block;
  box-sizing: border-box;
  width: auto;
  padding: 1em 2vw;
  margin: 1em 2vw;
  color: #000;
  background-color: rgba(204, 204, 204, 0.7);
  border: 0.07em solid rgba(0, 0, 0, 0.5);
  border-radius: 0.5em;

table {
  margin: 1em 0;
  border-collapse: collapse;
/*   width: 100%; */

caption {
  text-align: left;
  font-style: italic;
  padding: 0.25em 0.5em 0.5em 0.5em;

td {
  padding: 0.25em 0.5em 0.25em 1em;
  vertical-align: text-top;
  text-align: left;
  text-indent: -0.5em;

th {
  vertical-align: bottom;
  background-color: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-weight: bold;

td::before {
  display: none;

tr:nth-child(even) {
  background-color: rgba(255, 255, 255, 0.25);

tr:nth-child(odd) {
  background-color: rgba(255, 255, 255, 0.5);

td:nth-of-type(2) {
  font-style: italic;

td:nth-of-type(3) {
  text-align: right;

div {
  overflow: auto;

button {
  font-size: 90%;
  font-family: Lato, Arial, sans-serif;
  color: #fff;
  background-color: #00c;
  border: .1em solid #00f;
  border-radius: .5em;
  font-weight: bold;
  padding: .5em;
  text-align: center;
  box-shadow: .25em .25em .5em rgba(0, 0, 0, .5);

button[disabled] {
  background-color: #ccc;
  border-color: #ccc;
  color: #666;

button:not([disabled]):hover {
  color: #00f;
  background-color: #fff;
  outline: 0;

button[aria-pressed=true] {
  background-color: #000;
  border-color: #000;
  color: #ccc;

button:active {
  box-shadow: 0 0 .5em rgba(0, 0, 0, .5);

p:nth-child(4) {
  display: flex;
  flex-wrap: wrap;
  margin: 1em 0em 0 0em;

p:nth-child(4) button {
  flex: 1 0 10em;
  margin: 0.5em;


                function ToggleRowDisplay(CSSDisplay,selButton) {
  try {
    var theRows = document.querySelectorAll('tbody tr');
    for (var i = 0; i < theRows.length; i++) {
      theRows[i].setAttribute('style','display:' + CSSDisplay);
  } catch (e) {
    console.log("ToggleRowDisplay(): " + e);

function ToggleSelectedButton(selButton) {
  try {
    var theButtons = document.querySelectorAll('button');
    for (var i = 0; i < theButtons.length; i++) {
  } catch (e) {
    console.log("ToggleSelectedButton(): " + e);