Pen Settings

HTML

CSS

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

JavaScript

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

Packages

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.

Behavior

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.

HTML

              
                <table id="respTable">
  <thead>
    <tr>
      <th>Number</th>
      <th>Player</th>
      <th>Position</th>
      <th>Height</th>
      <th>Weight</th>
      <th>D.O.B.</th>
      <th>Experience</th>
      <th>From</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>0</td>
      <td>
        <a href="http://www.wnba.com/player/alana-beard/" target="_blank">Alana Beard</a>
      </td>
      <td>G-F</td>
      <td>5-11</td>
      <td>160</td>
      <td>May 14, 1982</td>
      <td>12</td>
      <td>Duke/USA</td>
    </tr>
    <tr>
      <td>17</td>
      <td>
        <a href="http://www.wnba.com/player/essence-carson/" target="_blank">Essence Carson</a>
      </td>
      <td>F-G</td>
      <td>6-0</td>
      <td>163</td>
      <td>July 28, 1986</td>
      <td>10</td>
      <td>Rutgers/USA</td>
    </tr>
    <tr>
      <td>12</td>
      <td>
        <a href="http://www.wnba.com/player/chelsea-gray/" target="_blank">Chelsea Gray</a>
      </td>
      <td>G</td>
      <td>5-11</td>
      <td>170</td>
      <td>October 8, 1992</td>
      <td>3</td>
      <td>Duke</td>
    </tr>
    <tr>
      <td>42</td>
      <td>
        <a href="http://www.wnba.com/player/jantel-lavender/" target="_blank">Jantel Lavender</a>
      </td>
      <td>C</td>
      <td>6-4</td>
      <td>185</td>
      <td>November 12, 1988</td>
      <td>7</td>
      <td>Ohio State/USA</td>
    </tr>
    <tr>
      <td>30</td>
      <td>
        <a href="http://www.wnba.com/player/nneka-ogwumike/" target="_blank">Nneka Ogwumike</a>
      </td>
      <td>F</td>
      <td>6-2</td>
      <td>174</td>
      <td>July 2, 1990</td>
      <td>6</td>
      <td>Stanford/USA</td>
    </tr>
    <tr>
      <td>3</td>
      <td>
        <a href="http://www.wnba.com/player/candace-parker/" target="_blank">Candace Parker</a>
      </td>
      <td>F-C</td>
      <td>6-4</td>
      <td>175</td>
      <td>April 19, 1986</td>
      <td>10</td>
      <td>Tennessee/USA</td>
    </tr>
    <tr>
      <td>44</td>
      <td>
        <a href="http://www.wnba.com/player/karlie-samuelson/" target="_blank">Karlie Samuelson</a>
      </td>
      <td>G</td>
      <td>6-0</td>
      <td></td>
      <td>May 10, 1995</td>
      <td>R</td>
      <td>Stanford</td>
    </tr>
    <tr>
      <td>1</td>
      <td>
        <a href="http://www.wnba.com/player/odyssey-sims/" target="_blank">Odyssey Sims</a>
      </td>
      <td>G</td>
      <td>5-8</td>
      <td>160</td>
      <td>July 13, 1992</td>
      <td>4</td>
      <td>Baylor</td>
    </tr>
    <tr>
      <td>10</td>
      <td>
        <a href="http://www.wnba.com/player/maria-vadeeva/" target="_blank">Maria Vadeeva</a>
      </td>
      <td>C</td>
      <td>6-4</td>
      <td></td>
      <td>July 16, 1998</td>
      <td>R</td>
      <td>Russia</td>
    </tr>
    <tr>
      <td>24</td>
      <td>
        <a href="http://www.wnba.com/player/sydney-wiese/" target="_blank">Sydney Wiese</a>
      </td>
      <td>G</td>
      <td>6-0</td>
      <td></td>
      <td>June 16, 1995</td>
      <td>1</td>
      <td>Oregon State</td>
    </tr>
    <tr>
      <td>2</td>
      <td>
        <a href="http://www.wnba.com/player/riquna-williams/" target="_blank">Riquna Williams</a>
      </td>
      <td>G</td>
      <td>5-7</td>
      <td>165</td>
      <td>May 28, 1990</td>
      <td>5</td>
      <td>Miami (Fla.)</td>
    </tr>
  </tbody>
</table>
              
            
!

CSS

              
                main {
  display: flex;
  justify-content: center;
}

table {
  max-width: 100%;
}

tr:nth-child(odd) {
  background-color: #eee;
}

th {
  background-color: #555;
  color: #fff;
}

th,
td {
  text-align: left;
  padding: 0.5em 1em;
}

td::before {
  display: none;
}

@media screen and (max-width: 680px) {
 table {
   border: 0;
   display: block;
   box-shadow: none;
 }

 thead {
   position: absolute;
   opacity: 0;
 }
  
 tbody {
   display: block;
   min-width: 19em;
   max-width: 25em;
 }

 tr {
   border-top: 2px solid #3c3c3b;
   border-bottom: 2px solid #3c3c3b;
   display: block;
   margin-bottom: 1em;
 }

 td {
   border-bottom: 1px solid #3c3c3b;
   display: flex;
 }

 td::before {
   display: inline-block;
   font-weight: bold;
   margin-right: auto;
   padding-right: 1em;
 }

 td:last-child {
   border-bottom: 0;
 }
}
              
            
!

JS

              
                /* Function modified from Adrian Roselli's article, A Responsive Accessible Table, http://adrianroselli.com/2017/11/a-responsive-accessible-table.html
*/
function cellHeaders(tableId) {
  try {
    let thArray = [];
    const table = document.getElementById(tableId);
    const headers = table.getElementsByTagName('th');
    for (let i = 0; i < headers.length; i++) {
      const headingText = headers[i].innerHTML;
      thArray.push(headingText);
    }
    const styleElm = document.createElement('style');
    let styleSheet;
    document.head.appendChild(styleElm);
    styleSheet = styleElm.sheet;
    for (let i = 0; i < thArray.length; i++) {
      styleSheet.insertRule(
        '#' +
          tableId +
          ' td:nth-child(' +
          (i + 1) +
          ')::before {content:"' +
          thArray[i] +
          ': ";}',
        styleSheet.cssRules.length
      );
    }
  } catch (err) {
    console.log('cellHeaders(): ' + err);
  }
}
cellHeaders('respTable');

              
            
!
999px

Console