Pen Settings



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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource


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


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.


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.


                <div class="stack">
  <div class="box stack">
    <h1>Default ratio: <code>1.33</code></h1>
    <h2>H2 heading</h2>
    <h3>H3 heading</h3>
    <p>Body font size, <code>1.6rem</code>, or <code>16px</code></p>
    <p>This pen is an illustration for a post about font sizes computed using a ratio. <br>
      <a href="">Read up more here.</a>
  <div class="cluster" style="--space: 1rem">
    <button class="button button--neutral" onclick="setRatio(1.125)">Ratio 1.125 - Major Second</button>
    <button class="button button--neutral" onclick="setRatio(1.20)">Ratio 1.20 - Mino Third</button>
    <button class="button button--neutral" onclick="setRatio(1.25)">Ratio 1.25 - Major Third</button>
    <button class="button button--neutral" onclick="setRatio(1.33)">Ratio 1.33 - Perfect Fourth</button>
    <button class="button button--neutral" onclick="setRatio(1.414)">Ratio 1.414 - Augmented Fourth</button>


                // Base font size
:root {
  font-size: 10px;
  background: #f5b4a5;
body {
  font-size: 1.6rem; /* 16px */
  background: #f5b4a5;
  color: #5f64e2;

// Setting the vars
:root {
  --font-ratio: 1.33;
  --size-300: calc(var(--size-400) / var(--font-ratio));
  --size-400: 1.6rem; /* 16px */
  --size-500: calc(var(--size-400) * var(--font-ratio));
  --size-600: calc(var(--size-500) * var(--font-ratio));
  --size-700: calc(var(--size-600) * var(--font-ratio));
  --size-800: calc(var(--size-700) * var(--font-ratio));
  --size-900: calc(var(--size-800) * var(--font-ratio));

// Use the var as font sizes

p {
  font-size: var(--size-400);

label {
  font-size: var(--size-300);

h1 {
  font-size: var(--size-700);

h2 {
  font-size: var(--size-600);

h3 {
  font-size: var(--size-500);

.box {
  background: transparent;



                function setRatio(ratio) {
  const root = document.querySelector(":root");"--font-ratio", ratio);