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

              
                <div class="container">
  <h1>Responsive CSS Tables</h1>
  <div class="table-1">
    <h2>Version 1</h2>
    <table>
      <tbody>
        <tr>
          <th>Block</th>
          <th>Element</th>
          <th>Modifier</th>
        </tr>
        <tr>
          <td data-th="Block">a person</td>
          <td data-th="Element">a hand</td>
          <td data-th="Modifier">a female person</td>
        </tr>
        <tr>
          <td data-th="Block">a menu</td>
          <td data-th="Element">a menu item</td>
          <td data-th="Modifier">a modified menu for the footer</td>
        </tr>
        <tr>
          <td data-th="Block">a search form</td>
          <td data-th="Element">a search input field</td>
          <td data-th="Modifier">a search input field with a particular button style</td>
        </tr>
      </tbody>
    </table>
  </div>
  <div class="table-2">
    <h2>Version 2</h2>
    <table>
      <tbody>
        <tr>
          <th>Block</th>
          <th>Element</th>
          <th>Modifier</th>
        </tr>
        <tr>
          <td data-th="Block">a person</td>
          <td data-th="Element">a hand</td>
          <td data-th="Modifier">a female person</td>
        </tr>
        <tr>
          <td data-th="Block">a menu</td>
          <td data-th="Element">a menu item</td>
          <td data-th="Modifier">a modified menu for the footer</td>
        </tr>
        <tr>
          <td data-th="Block">a search form</td>
          <td data-th="Element">a search input field</td>
          <td data-th="Modifier">a search input field with a particular button style</td>
        </tr>
      </tbody>
    </table>
  </div>
  <div class="table-3">
    <h2>Version 3</h2>
    <table>
      <tbody>
        <tr>
          <th>Exercise/Movement</th>
          <th>Do this</th>
          <th>Because</th>
        </tr>
        <tr>
          <td data-th="Exercise/Movement">Single Arm Circles</td>
          <td data-th="Do this">10 times in each direction</td>
          <td data-th="Because">I said so</td>
        </tr>
        <tr>
          <td data-th="Exercise/Movement">Arm Crossing</td>
          <td data-th="Do this">10 times, alternating arms top/bottom</td>
          <td data-th="Because">You deserve a hug</td>
        </tr>
        <tr>
          <td data-th="Exercise/Movement">Hip Circles</td>
          <td data-th="Do this">Until the world spins</td>
          <td data-th="Because">You should get your groove on</td>
        </tr>
      </tbody>
    </table>
  </div>
</div>
              
            
!

CSS

              
                @import url(https://fonts.googleapis.com/css?family=Roboto:400,700);
html {
  font-size: 62.5%;
}

body {
  font-family: 'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 1.6rem;
  line-height: 1.6;
  color: #20262e;
  background-color: #28b1de;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  max-width: 800px;
  margin: 40px auto;
  padding: 0 5%;
}

h1 {
  text-align: center;
  font-size: 3rem;
  color: rgba(255, 255, 255, .8);
  text-transform: uppercase;
  line-height: 1.375;
  margin: 0 0 2.4rem 0;
  letter-spacing: 1px
}

h2 {
  text-align: right;
  font-size: 1.2rem;
  text-transform: uppercase;
  line-height: 1.375;
  margin: 0;
  letter-spacing: 1px
}

table {
  width: 100%;
  min-width: 300px;
  margin-bottom: 2.4rem;
  background-color: #20262e;
  color: #fff;
  overflow: hidden;
}

table tr:nth-child(even) {
  background-color: rgb(46, 53, 62);
}

table th,
table td:before {
  color: #28b1de;
}

table th {
  display: none;
}

table th,
table td {
  margin: .5rem 2rem;
  text-align: left;
}

table td {
  display: block;
  font-size: 90%;
}

table td:first-child {
  padding-top: 1rem;
}

table td:last-child {
  padding-bottom: 1rem;
}

table td:before {
  content: attr(data-th) ':\00a0';
  font-weight: bold;
  min-width: 8rem;
  display: inline-block;
}

.table-2 table td:before {
  min-width: 0;
}

.table-3 table {
  background-color: rgb(46, 53, 62);
}

.table-3 table tr:nth-child(even) {
  background-color: transparent;
}

.table-3 table td:before {
  width: 100%;
  font-weight: normal;
  opacity: .8;
}

.table-3 table td {
  margin: 0;
  padding: 1.5rem 2rem 0 2rem;
  font-weight: bold
}

.table-3 table tr td:first-child {
  background-color: #20262e;
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
}

.table-3 table tr td:last-child {
  padding-bottom: 1.5rem;
  border-bottom: 4px solid rgba(255, 255, 255, .3)
}

.table-3 table tr:last-child td:last-child {
  border-bottom: none;
}

@media (min-width: 600px) {
  table td:before {
    display: none;
  }
  table th,
  table td {
    display: table-cell;
  }
  table th,
  table td,
  table td:first-child,
  table td:last-child {
    padding: 1.5rem 2rem;
  }
  .table-3 table {
    background-color: #20262e;
  }
  .table-3 table tr:nth-child(even) {
    background-color: rgb(46, 53, 62);
  }
  .table-3 table td {
    margin: .5rem 2rem;
    padding: 1.5rem 2rem;
    font-weight: normal
  }
  .table-3 table tr td:first-child {
    background-color: transparent;
  }
  .table-3 table tr td:last-child {
    border-bottom: none;
  }
}
              
            
!

JS

              
                
              
            
!
999px

Console