Pen Settings



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


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.


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.


                <link href=",700" rel="stylesheet">
<!-- app -->
<div class="app js-app">
  <div class="app__col app__col--source js-source">
    <!-- squere -->
    <div class="squere js-squere"></div>
    <!-- / squere -->
  <div class="app__col app__col--small">
    <!-- clone -->
    <button class="clone js-clone">Clone</button>
    <!-- / clone -->
    <!-- counter -->
    <p class="counter js-counter">0</p>
    <!-- / counter -->
  <div class="app__col app__col--destination js-destination">
<!-- / app -->


                // very professional reset
* {
  margin: 0;
  box-sizing: border-box;

// app
.app {
  font-family: 'Source Sans Pro', sans-serif;
  font-size: 1rem;
  line-height: 1.6rem;
  display: flex;
  width: 100vw;
  height: 100vh;
  padding: .5rem;
  background: #eee;
  align-items: stretch;

.app__col {
  display: flex;
  flex-wrap: wrap;
  position: relative;
  background: #fff;
  flex-basis: 40%;
  justify-content: center;
  align-items: center;
  margin: .5rem;
  border: 1px solid #ccc;
  padding: 1rem;
  &::before {
    position: absolute;
    top: 0;
    left: 0;
    background-color: #ccc;
    padding: .5rem;

.app__col--source::before {
  content: 'source';

.app__col--destination::before {
  content: 'destination';

.app__col--small {
  flex-direction: column;
  flex-basis: 20%;

// squere
.squere {
  display: block;
  width: 3.2rem;
  height: 3.2rem;
  background-color: #000;
  margin: .4rem;

// clone
.clone {
  width: 100%;
  display: block;
  border: #ccc;
  background: #ccc;
  margin-bottom: 1.6rem;
  font: inherit;
  line-height: 3.2rem;

// counter
.counter {
  width: 100%;
  text-align: center;
  font-size: 2rem;
  font-weight: 700;


                // DOM references
const app = document.querySelector('.js-app');
const columnSource = document.querySelector('.js-source');
const columnDestination = document.querySelector('.js-destination');
const clone = document.querySelector('.js-clone');
const counter = document.querySelector('.js-counter');

// increament the counter on squere click
function squereClickHandler(e) {
  const newCounterValue = parseInt(counter.innerText) + 1;
  counter.innerText = newCounterValue;

// clone squere from source to destination on clone button click
function cloneClickHandler() {
  // 1. Using cloneNode
  const copy = columnSource.querySelector('.js-squere').cloneNode(true);
  // 2. Using importNode
  // const copy = document.importNode(sun, true);
  // destination.appendChild(copy);

// use events delegation and track clicks on whole app
app.addEventListener('click', (e) => {
  // check it clicked element contains class js-squere
  if ('.js-squere')) {

// attach handler to clone button
clone.addEventListener('click', cloneClickHandler);