cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation

     

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.

            
              <div class="container">
	<!-- Change table-container width -->
  <input type="checkbox" id="container-width">
  <label for="container-width">Container width:</label>
  <!-- Change table layout -->
  <input type="checkbox" id="table-layout">
  <label for="table-layout">Table layout:</label>
  <!-- Remove optional columns -->
  <input type="checkbox" id="remove-col1" class="remove-content">
  <label for="remove-col1">1</label>
  <input type="checkbox" id="remove-col2"  class="remove-content">
  <label for="remove-col2">2</label>
  <input type="checkbox" id="remove-col3"  class="remove-content">
  <label for="remove-col3">3</label>
  <input type="checkbox" id="remove-col4"  class="remove-content">
  <label for="remove-col4">4</label>
  <input type="checkbox" id="remove-col5"  class="remove-content">
  <label for="remove-col5">5</label>
  <!-- Begin table container -->
  <div class="table-container">
    <!-- Normal text (default) -->
    <input type="radio" name="text-option" id="text-normal" checked>
    <label for="text-normal">Normal</label>
    <!-- Break words -->
    <input type="radio" name="text-option" id="text-break">
    <label for="text-break">Break word</label>
    <!-- Force ellipsis -->
    <input type="radio" name="text-option" id="text-ellipsis">
    <label for="text-ellipsis">Ellipsis</label>
    <table>
      <tr>
        <th>Header 1</th>
        <th>Header 2</th>
        <th>Header 3</th>
        <th>Header 4</th>
        <th>Header 5</th>
      </tr>
      <tr>
        <td>Here's a whole load of content, so that I can decently attempt to judge how the table reflows when certain properties are applied.</td>
    <td>forename.surname@reallylongdomain.com</td>
        <td>Here's a whole load of content, so that I can decently attempt to judge how the table reflows when certain properties are applied.</td>
        <td>Here's a whole load of content, so that I can decently attempt to judge how the table reflows when certain properties are applied.</td>
        <td>Here's a whole load of content, so that I can decently attempt to judge how the table reflows when certain properties are applied.</td>
      </tr>
      <tr>
        <td>Here's a whole load of content, so that I can decently attempt to judge how the table reflows when certain properties are applied.</td>
        <td>forename.surname@prettylongdomain.com</td>
        <td>Here's a whole load of content, so that I can decently attempt to judge how the table reflows when certain properties are applied.</td>
        <td>Here's a whole load of content, so that I can decently attempt to judge how the table reflows when certain properties are applied.</td>
        <td>Here's a whole load of content, so that I can decently attempt to judge how the table reflows when certain properties are applied.</td>
      </tr>
    </table>
  </div>
</div>
            
          
!
            
              body {
	font-family:sans-serif;
  padding:0 1em;
  margin:0;
  font-size:12px;
  background:#eee;
}
.container {
  margin:0 auto;
  max-width:980px;
  padding:2em 1em 0.2em 1em;
  background:white;
}
input {
 	position: absolute;
  top: -9999px;
  left: -9999px; 	
}
label {
  cursor:pointer;
  font-weight:normal;
  &:after { font-weight:bold; }
}
.text-ellipsis {
  white-space: nowrap;
	overflow: hidden;
	-o-text-overflow: ellipsis;
	-ms-text-overflow: ellipsis;
	text-overflow: ellipsis; /* or "clip" */
}
.text-wrap {
	word-wrap:break-word;
  overflow-wrap:break-word;
}
.table-container {
 margin:1em auto;
 padding:0;
 table {
    margin:1em auto;
    table-layout:auto;
    width:100%;
    border-collapse:collapse;
    border-left:1px solid #ddd;
  }
  tr {
  	background:white;
    &:nth-child(odd) {
      background:#e3effa;
    }
  }
  th {
  	background:#444;
    color:#eee;
    padding:0.5em 1em;
    text-shadow:1px 1px 2px rgba(0,0,0,1);
    border:1px solid #111;
    border-left:none;
    &:first-child {
      border-left:1px solid #111;
    }
  }
  td {
    padding:0.5em 1em;
    border-bottom:1px solid #ccc;
    border-right:1px solid #ccc;
    &:first-child {
      border-left:1px solid #ccc;
    }
  }
}
/* Now apply certain controls using checkboxes */
input {
  + label {
    display:inline-block;
    border:1px solid #ddd;
    padding:0.2em 1em;
    border-radius:2px;
    position:relative;
  }
}
label[for="container-width"]:after {
  content:" 100%";
}
label[for="table-layout"]:after {
  content:" auto";
}
input[type=checkbox]#container-width:checked {
  ~ .table-container { width:50%; }
  + label:after {
  	content:" 50%";
	}
}
input[type=checkbox]#table-layout:checked {
  ~ .table-container table {
    table-layout:fixed;
  }
  + label:after {
  	content:" fixed";
	}
}
input[type=checkbox].remove-content {
  + label {
    padding:0.2em 0.5em;
    font-weight:bold;
  }
  &:checked + label { font-weight:normal; }
  &#remove-col1 {
    + label {
    	margin-left:9em;
      &:before {
        content:"Remove column: ";
        position:absolute;
        left:-8.1em;
        font-weight:normal;
      }
    }
    &:checked ~ .table-container table {
      th,td {
        &:nth-child(1) {
          display:none;
        }
      }
    }
  }
  &#remove-col2:checked ~ .table-container table {
    th,td {
      &:nth-child(2) {
        display:none;
      }
    }
  }
  &#remove-col3:checked ~ .table-container table {
    th,td {
      &:nth-child(3) {
        display:none;
      }
    }
  }
  &#remove-col4:checked ~ .table-container table {
    th,td {
      &:nth-child(4) {
        display:none;
      }
    }
  }
  &#remove-col5:checked ~ .table-container table {
    th,td {
      &:nth-child(5) {
        display:none;
      }
    }
  }
}
input[type=radio] {
	+ label {}
}
input[type=radio]:checked {
	+ label {
    background:#eee;
    border-color:#999;
  }
}
input[type=radio]#text-break:checked {
  ~ table td { .text-wrap; }
}
input[type=radio]#text-ellipsis:checked {
  ~ table td { .text-ellipsis; }
}
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console