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>
  <p>
    <label>
      Font size:
      <input id="numFontSize" type="range" min="5" max="30" />
    </label>
    <output id="outputFontSize"></output>
  </p>
  <p>
    <label>
      Columns:
      <input id="numColumns" type="range" min="1" max="10" />
    </label>
    <output id="outputColumns"></output>
  </p>
  <p>
    <label>
      Widows:
      <input id="numWidows" type="range" min="1" max="10" />
    </label>
    <output id="outputWidows"></output>
  </p>
  <p>
    <label>
      Orphans:
      <input id="numOrphans" type="range" min="1" max="10" />
    </label>
    <output id="outputOrphans"></output>
  </p>
</div>
<div class="frame">
  <p>Hello World!</p>
  <p>
    Lorem ipsum dolor sit amet consectetur adipisicing elit. Consectetur voluptatum eum nulla. Corrupti aut, repellendus sunt quia, eligendi iure harum incidunt optio exercitationem rem quis maxime facilis alias dolorem illo?
    Fuga amet facere dolores asperiores minima non voluptatem laudantium exercitationem consequuntur aspernatur reiciendis molestiae in animi, repudiandae optio. Error veniam harum mollitia similique eligendi dolorem minus neque ab accusantium numquam.
  </p>
  <p>
    Hic tenetur magnam facere iure explicabo architecto eius non voluptatibus consequatur? Saepe velit nihil exercitationem ducimus dolore voluptas aliquid! Vitae libero omnis asperiores voluptate beatae vero, cumque at modi pariatur.
    Dolore voluptate commodi quas ut nemo molestiae excepturi repellendus alias facilis ipsa cupiditate distinctio corporis nostrum tempora repellat unde veniam numquam molestias perspiciatis, sed inventore sint quidem! Dolore, veritatis fugiat!
    Repellendus nihil laboriosam odio tempore blanditiis iure fuga? Assumenda, voluptas nulla. Sapiente accusamus odio neque qui consequatur dolorum veritatis amet rerum dignissimos ab, reprehenderit, vel numquam laudantium. Pariatur, possimus rem!
  </p>
  <p>
    Dicta nam, soluta rem et pariatur reprehenderit placeat expedita earum perferendis mollitia deserunt ipsum, voluptatem impedit beatae vel ratione ipsa temporibus accusantium. Magni beatae nesciunt totam error numquam at eos!
    Eligendi, quos ducimus maxime autem necessitatibus blanditiis? Maiores suscipit aspernatur expedita, repellat beatae aut reiciendis eum illum blanditiis sit deleniti eos ea rerum? Recusandae beatae quia obcaecati, dignissimos asperiores consectetur!
    Ea nostrum dolorum quibusdam saepe optio totam ex provident, ab vel molestias obcaecati autem, iure cum recusandae ad architecto labore placeat voluptatum repudiandae porro, aut fuga pariatur reiciendis? Beatae, perspiciatis.
    Esse vero enim, dolore itaque autem amet. Consequatur sapiente ipsam voluptates animi porro deleniti velit, incidunt harum repellendus ducimus, earum recusandae, eum in esse nisi sed reiciendis eligendi placeat laboriosam!
    Asperiores minus tenetur provident et accusantium. Molestias blanditiis magni ipsa porro aliquid asperiores consequuntur animi optio? At cum, obcaecati, libero quibusdam velit dolorem praesentium consectetur, debitis sit qui laudantium non!
  </p>
  <p>
    Pariatur facere aliquid quidem minus debitis itaque architecto magnam saepe inventore fuga nisi, quaerat expedita aliquam veritatis illo ipsa tempore incidunt quis consectetur aut dignissimos esse eveniet dolore. Debitis, nostrum?
  </p>
</div>

              
            
!

CSS

              
                body {
  --font-size: 10px;
  --columns: 5;
  --widows: 2;
  --orphans: 2;
}

.frame {
  border: 1px solid lightgray;
  columns: var(--columns);
  font-size: var(--font-size);
  orphans: var(--orphans);
  widows: var(--widows);

  p {
    background-color: lightgray;
    line-height: 1.2;
    margin: 0;
    text-indent: 1rem;
  }

  p + p {
    margin-top: 1rem;
  }
}

              
            
!

JS

              
                let fontSize = 10;
let columns = 5;
let widows = 2;
let orphans = 2;

const elNumFontSize = document.querySelector('#numFontSize');
const elOutputFontSize = document.querySelector('#outputFontSize');
const elNumColumns = document.querySelector('#numColumns');
const elOutputColumns = document.querySelector('#outputColumns');
const elNumWidows = document.querySelector('#numWidows');
const elOutputWidows = document.querySelector('#outputWidows');
const elNumOrphans = document.querySelector('#numOrphans');
const elOutputOrphans = document.querySelector('#outputOrphans');

elNumFontSize.addEventListener('input', () => {
  fontSize = elNumFontSize.valueAsNumber;
  render();
});

elNumColumns.addEventListener('input', () => {
  columns = elNumColumns.valueAsNumber;
  render();
});

elNumWidows.addEventListener('input', () => {
  widows = elNumWidows.valueAsNumber;
  render();
});

elNumOrphans.addEventListener('input', () => {
  orphans = elNumOrphans.valueAsNumber;
  render();
});

function render() {
  elNumFontSize.value = fontSize;
  elOutputFontSize.textContent = `${fontSize}px`;
  document.body.style.setProperty('--font-size', `${fontSize}px`);

  elNumColumns.value = columns;
  elOutputColumns.textContent = columns;
  document.body.style.setProperty('--columns', columns);


  elNumWidows.value = widows;
  elOutputWidows.textContent = widows;
  document.body.style.setProperty('--widows', widows);

  elNumOrphans.value = orphans;
  elOutputOrphans.textContent = orphans;
  document.body.style.setProperty('--orphans', orphans);
}

render();

              
            
!
999px

Console