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

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

              
                <table>
  <thead>
    <tr class="spectrum">
      <td></td>
      <td><svg width="24" height="24" viewBox="0 0 24 24">
  <path d="M12,3C7.58,3 4,4.79 4,7C4,9.21 7.58,11 12,11C16.42,11 20,9.21 20,7C20,4.79 16.42,3 12,3M4,9V12C4,14.21 7.58,16 12,16C16.42,16 20,14.21 20,12V9C20,11.21 16.42,13 12,13C7.58,13 4,11.21 4,9M4,14V17C4,19.21 7.58,21 12,21C16.42,21 20,19.21 20,17V14C20,16.21 16.42,18 12,18C7.58,18 4,16.21 4,14Z"></path>
</svg><br>Server</td>
      <td colspan="3" class="dashed"></td>
      <td><svg width="24" height="24" viewBox="0 0 24 24">
  <path d="M16,18H7V4H16M11.5,22A1.5,1.5 0 0,1 10,20.5A1.5,1.5 0 0,1 11.5,19A1.5,1.5 0 0,1 13,20.5A1.5,1.5 0 0,1 11.5,22M15.5,1H7.5A2.5,2.5 0 0,0 5,3.5V20.5A2.5,2.5 0 0,0 7.5,23H15.5A2.5,2.5 0 0,0 18,20.5V3.5A2.5,2.5 0 0,0 15.5,1Z"></path>
</svg><br>Browser</td>
    </tr>
    <tr class="types">
      <td></td>
      <th>Server Rendering</th>
      <th>Static SSR</th>
      <th>SSR with Rehydratthion</th>
      <th>CSR with Prerendering</th>
      <th>Client Side Rendering</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>Overview:</th>
      <td>An application where input is navigation requests and output is HTML in response to them.</td>
      <td>Built as a Single Page App, but all pages prerendered to static HTML as a build step, and the JavaScript is <strong>removed</strong>.</td>
      <td>Built as a Single Page App. The server prerenders pages, but the full app is also booted on the client.</td>
      <td>A Single Page App, where the initial shell/skeleton is prerendered to static HTML at build time.</td>
      <td>A Single Page App. All logic, rendering, and booting is done on the client. HTML is essentially just &lt;script> and style tags.</td>
    </tr>
    <tr>
      <th>Authoring:</th>
      <td>Entirely server-side.</td>
      <td>Built as if client-side</td>
      <td>Built as if client-side</td>
      <td>Client-side</td>
      <td>Client-side</td>
    </tr>
    <tr>
      <th>Rendering:</th>
      <td>Dynamic HTML</td>
      <td>Static HTML</td>
      <td>Dynamic HTML and JavaScript/DOM</td>
      <td>Partial static HTML, then JavaScript/DOM</td>
      <td>Entirely JavaScript/DOM</td>
    </tr>
    <tr>
      <th>Server role:</th>
      <td>Controls all aspects (thin client)</td>
      <td>Delivers static HTML</td>
      <td>Renders pages</td>
      <td>Delivers static HTML</td>
      <td>Delivers static HTML</td>
    </tr>
    <tr>
      <th>Pros:</th>
      <td>👍 TTI = FCP<br>👍 Fully Streaming</td>
      <td>👍 Fast TTFB<br>👍 TTI = FCP<br>👍 Fully Streaming</td>
      <td>👍 Flexible</td>
      <td>👍 Flexible<br>👍 Fast TTFB</td>
      <td>👍 Flexible<br> 👍 Fast TTFB</td>
    </tr>
    <tr>
      <th>Cons:</th>
      <td>👎 Slow TTFB<br>👎 Inflexible</td>
      <td>👎 Inflexible<br>👎 Leads to hydration</td>
      <td>👎 Slow TTFB<br>👎 TTI >>> FCP<br>👎 Limited Streaming</td>
      <td>👎 TTI > FCP<br>👎 Limited Streaming</td>
      <td>👎 TTI >>> FCP<br>👎 No Streaming</td>
    </tr>
    <tr>
      <th>Scales via:</th>
      <td>Infra size / cost</td>
      <td>build/deploy size</td>
      <td>infra size and JavaScript size</td>
      <td>JavaScript size</td>
      <td>JavaScript size</td>
    </tr>
    <tr>
      <th>Examples:</th>
      <td>Gmail HTML, Hacker News</td>
      <td>Docusaurus, Netflix</td>
      <td>Next.js, Razzle</td>
      <td>Gatsby, Vuepress</td>
      <td>Most apps</td>
    </tr>
  </tbody>
</table>
              
            
!

CSS

              
                @import url("https://fonts.googleapis.com/css?family=Open+Sans:400,400i,700");

body {
  font-family: 'Open Sans', sans-serif;
  font-size: 12px;
  line-height: 1.2;
}

table {
  border-spacing: 20px 10px;
}

.spectrum {
  td {
    text-align: center;
  }
}

.types {
  th {
    position: sticky;
    top: 0;
    background: #EDF0F7;
    border: 1px solid #BFD2EA;
    color: #01579B;
    padding: 1rem;
  }
}

.dashed {
  background: 
    url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/3/left-arrow.svg),
    url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/3/dash.svg),
    url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/3/right-arrow.svg);
  background-size: 20px;
  background-position: left center, center center, right center;
  background-repeat: no-repeat, repeat-x, no-repeat;
}

tbody {
  th {
    text-align: left;
    font-weight: 100;
    color: #aaa;
  }
  tr {
    box-shadow: 0 1px 0 #ccc;
  }
  th, td {
    padding-bottom: 0.5rem;
  }
}


              
            
!

JS

              
                
              
            
!
999px

Console