Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ 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

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.

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

              
                <h1>Default Tables are Weird</h1>

<table>
  <tr>
    <td>I'm a table</td>
    <td>and stuff</td>
  </tr>
</table>

<table>
  <tr>
    <td>I'm as wide</td>
    <td>as the cells are</td>
  </tr>
</table>

<table>
  <tr>
    <td>I can easily become 100% wide.</td>
    <td>and I'll stop there if I possibly can.</td>
  </tr>
</table>

<table>
  <tr>
    <td>If you don't specify it,</td>
    <td>the cells will be kind of arbitrarily wide depending on the content inside. This one is way wider right? ¯\(°_o)/¯</td>
  </tr>
</table>

<table class="respect">
  <tr>
    <td>If you <strong>do</strong> specify it,</td>
    <td>that will be respected if it's possible to do so. These should be 50% wide.</td>
  </tr>
</table>

<table class="thousand">
  <tr>
    <td>But things can get weird.</td>
    <td>I told both of these cells to be 1000px wide and it's like NOPE.</td>
  </tr>
</table>

<table class="calc">
  <tr>
    <td>It's kinda like a calculation. I'm told to be 2000px wide, thus I'm 66.66% wide (2/3 of total 3000px). </td>
    <td>And I'm told to be 1000px wide, thus I'm 33.33% wide (1/3 of total 3000px).</td>
  </tr>
</table>

<table class="image">
  <tr>
    <td>An image that's too wide though?</td>
    <td>That'll bust out like nobody's business.
    <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/3/dock-slice-2.png" />
    You can try hiding the overflow but that doesn't work.
    </td>
  </tr>
</table>
  
<table class="whitespace">
  <tr>
    <td>Or some non-wrapping text?</td>
    <td>That'll blast out a table in short order like this.</td>
  </tr>
</table>
  
<table class="code">
  <tr>
    <td>Which is an issue for preformatted text, like code.</td>
    <td><pre>
body.logged-in article > h2 {
  background: linear-gradient(rgba(0, 0, 0, 0), rgba(255, 0, 0, 0.2));      
}
    </pre></td>
  </tr>
</table>
              
            
!

CSS

              
                td {
  border: 1px solid black;
}
table {
  margin: 15px 0;
  border: 1px solid black;
}
html {
  background: #ccc;
}
body {
  max-width: 400px;
  margin: 0 auto;
  background: white;
  padding: 10px;
}

.respect td {
  width: 50%;
}

.thousand td {
  width: 1000px;
}

.image td {
  overflow: hidden;
}

.whitespace td {
  white-space: nowrap;
}

.calc td:nth-child(1) {
  width: 2000px;
}
.calc td:nth-child(2) {
  width: 1000px;
}

              
            
!

JS

              
                
              
            
!
999px

Console