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

              
                 <header>
  <span id="toggle">Toggle Grid</span>

  <span id="palette-1" class="active">Palette 1</span>

  <span id="palette-2">Palette 2</span>

  <span id="palette-3">Palette 3</span>

  <span id="palette-4">Palette 4</span>

  <span id="palette-5">Palette 5</span>
</header>

<div class="container">
  <div class="main-col">
    <h1>Lorem ipsum dolor sit&nbsp;amet</h1>
    <p class="caption">Labore reprehenderit corporis ullam distinctio&nbsp;ex.</p>
    <p>Consectetur adipisicing elit, alias at autem magna aliquid <a href="#">quam proident</a> quis aliquam. temporibus minus eius veniam cupidatat ex, voluptas fuga, quos, mollitia incidunt do officia facilis. molestiae consequat excepturi laborum perferendis tempor minim eiusmod minim minus quia&nbsp;sint.</p>
    <p class="caption sidenote">Maiores at duis consequatur corrupti.</p>
    <p>Quos atque officia quod. <i>Suscipit delectus</i> cupidatat, quia nulla numquam aute cillum proident. Maiores iusto culpa molestias quam id tenetur saepe impedit reiciendis itaque ducimus itaque nostrud. Tempor aliquip, culpa earum itaque sed consequatur minus aliquip reprehenderit nihil veniam tempora do maxime omnis reiciendis elit&nbsp;tempora.</p>
    <ol>
      <li>Perferendis tempor</li>
      <li>Minim eiusmod </li>
      <li>Tempor</li>
      <li>Minus quia sint</li>
    </ol>
  </div>
  <div class="main-col">
    <h2>Voluptates&nbsp;mollitia</h2>
    <p>Proident dolores corrupti consequatur voluptatibus labore commodi quos. <b>Incidunt mollitia</b> tempora assumenda laborum voluptate accusamus dolore optio incididunt. Maiores at duis consequatur corrupti consectetur, aliquam optio commodo accusamus distinctio, necessitatibus&nbsp;nostrum.</p>
    <p>Optio, nesciunt, quo, fugiat, blanditiis at quas excepturi quae maiores vel corrupti voluptate cupiditate nemo! In, eius quidem harum quibusdam ratione non. Iste, deleniti, fugit, voluptas aperiam qui adipisci provident ab accusantium possimus eveniet voluptate&nbsp;consectetur!</p>
    <h2>Repellat optio</h2>
    <h3>Ad perferendis omnis</h3>
    <p>Pariatur animi quis. Dolorem cupiditate <a href="#">praesentium duis</a> iusto corrupti nobis nostrud, exercitation consequatur. Nulla minim dignissimos reprehenderit voluptatem. Recusandae delectus iure vel asperiores saepe dolorum omnis eu aliquam&nbsp;similique.</p>
    <blockquote><p>Fuga rerum laboris officia cupidatat, excepteur aliquid ut quis facere, cumque harum optio dignissimos. Duis repellat tempore dolor blanditiis alias impedit officiis ut&nbsp;consectetur.</p></blockquote>
    <h4>Quibusdam illum quo</h4>
    <p>Quos laboris eos, laborum animi. Ea blanditiis ducimus fugiat officia nostrud consectetur recusandae excepteur. Quis qui maiores distinctio facilis saepe&nbsp;eos.</p>
<pre><code>body {
    color: blue;
}</code></pre>
  </div>
  <div class="sidebar">
    <h3>Consectetur</h3>
    <p>Iure vel nostrud repellendus. <b>Nostrud</b> autem consequatur, provident officiis qui, mollit exercitation.</p>
  </div>
  <div class="main-col">
    <p>Corporis eligendi minim, enim proident reprehenderit iusto. <i>Reprehenderit</i> commodo commodi, repudiandae voluptas saepe sint libero. Praesentium eius distinctio ullamco vero iusto praesentium eligendi animi. Consectetur dolore vero similique dolore, ut labore&nbsp;omnis.</p>
    <h6>Maxime alias anim similique</h6>
    <p>Omnis corporis assumenda nisi ullam dolores culpa repellat. Molestias praesentium necessitatibus minus, reiciendis officiis commodo incidunt. Consectetur nostrud odio numquam&nbsp;tenetur.</p>
    <hr>
    <h1>Heading level 1</h1>
    <h2>Heading level 2</h2>
    <h3>Heading level 3</h3>
    <h4>Heading level 4</h4>
    <h5>Heading level 5</h5>
    <h6>Heading level 6</h6>
    <p>Paragraph with <b>bold</b>, <i>italic</i>, <a href="#">link</a> and <code>code</code> styles.</p>
    <blockquote><p>Blockquote</p></blockquote>
    <p class="caption">Caption text</p>
    <ol>
      <li>Ordered list element one</li>
      <li>Ordered list element two</li>
      <li>Ordered list element three</li>
    </ol>
    <ul>
      <li>Unordered list element one</li>
      <li>Unordered list element two</li>
      <li>Unordered list element three</li>
    </ul>  
  </div>    
</div>
              
            
!

CSS

              
                /* Demo web fonts from Adobe Fonts */
@import url("https://use.typekit.net/swm2ywc.css");

/* Font palettes */
body, body.palette-1 {
  --head-fonts: verdana, sans-serif;
  --body-fonts: georgia, serif;
  --code-fonts: calling-code, monospace;
}

body.palette-2 {
  --head-fonts: -apple-system, BlinkMacSystemFont, Aptos, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif;
  --body-fonts: -apple-system-ui-serif, ui-serif, "Noto Serif", "Times New Roman", serif;
  --code-fonts: ui-monospace, SFMono-Regular, ui-monospace, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
}

body.palette-3 {
  --head-fonts: brandon-grotesque, sans-serif;
  --body-fonts: elmhurst, serif;
  --code-fonts: calling-code, monospace;
}

body.palette-4 {
  --head-fonts: ff-tisa-sans-web-pro, sans-serif;
  --body-fonts: karmina, serif;
  --code-fonts: source-code-pro, monospace;
}

body.palette-5 {
  --head-fonts: delittle-chromatic, sans-serif;
  --body-fonts: omnes-pro, sans-serif;
  --code-fonts: logic-monoscript, monospace;
}

/* Set baseline size */
:root { 
  font-size: 100%;
}

/* Show baseline grid */
html.show-grid body {
  background-image: linear-gradient(to bottom, #0ff 0, transparent 1px);
  background-repeat: repeat-y;
  background-size: 100% 1rem;
}

/* Set headings to baseline */
h1, h2, h3, h4, h5, h6 {
  --baselines: 3;
  --beneath: 1;
  --baseline-shift: calc(calc(calc(var(--baselines) * 1rem) - 1cap) / 2);
  --baseline-push: calc(calc(var(--beneath) * 1rem) - var(--baseline-shift));
  
  font-family: var(--head-fonts);
  font-weight: 700;
  line-height: calc(var(--baselines) * 1rem);
  margin: 0;
  padding: 0;
  font-feature-settings: 'kern', 'lnum', 'liga';
  padding-top: var(--baseline-shift);
	margin-bottom: var(--baseline-push);
}

h4, h5, h6 {
  --baselines: 2;
  --beneath: 0;
}

/* Set text to baseline */
p, ul, ol {
  --baselines: 2;
  --beneath: 1;
  --baseline-shift: calc(calc(calc(var(--baselines) * 1rem) - 1cap) / 2);
  --baseline-push: calc(calc(var(--beneath) * 1rem) - var(--baseline-shift));
  
  font-family: var(--body-fonts);
  font-size: 1.2rem;
  line-height: calc(var(--baselines) * 1rem);
  margin: 0;
  padding: 0; 
  font-feature-settings: 'kern', 'onum', 'liga';
  padding-top: var(--baseline-shift);
	margin-bottom: var(--baseline-push);
}

p + h1, ul + h1, ol + h1,
p + h2, ul + h2, ol + h2,
p + h3, ul + h3, ol + h3 { 
	padding-top: calc(var(--baseline-shift) + 1rem);
}


/* Heading sizing modular scale */
h1 {
  font-size: 2.986rem;
}

h2 {
  font-size: 2.488rem;
}

h3 {
  font-size: 2.074rem;
}

h4 {
  font-size: 1.728rem;
}

h5 {
  font-size: 1.44rem;
}

h6 {
  font-size: 1.2rem;
}

/* Additional typographic element styling */
.caption {
  font-size: 1rem;
}

h1 + .caption, h2 + .caption, h3 + .caption {
  margin-top: -1rem;
}

.sidenote {
  left: 65%;
  width: 35%;
  padding-left: 4rem;
  position: absolute;
  max-width: 35%;
}

code, pre {
  font-family: var(--code-fonts);
}

pre {
  background-color: rgba(245, 245, 215, 0.5);
  display: block;
  margin-bottom: 2rem;
  padding: 1rem;
  white-space: pre;
  white-space: pre-wrap;
  word-break: break-all;
  word-wrap: break-word;
}

code {
  line-height: 1rem;
}

blockquote {

  p {
    border-left: 0.15rem solid blue;
    font-style: italic;
    padding-left: 1rem;
    padding-bottom: calc(calc(var(--beneath) * 1rem) - calc(calc(calc(var(--baselines) * 1rem) - 1cap) / 2));
    margin-bottom: 1rem;
  }
}

b, strong {
  font-weight: 700;
}

em, i {
  font-style: italic;
}

ul, ol {

  li {

    ol, ul {
      padding-top: 1rem;
      margin-bottom: 1rem;
      margin-left: 2rem;
    }
  }
}

ul {
  list-style-type: disc;
}

ol {
  list-style-type: none;

  li {
    counter-increment: top-level;

    &:before {
      content: counter(top-level) '.';
      font-feature-settings: 'lnum', 'tnum';
      margin-left: -3rem;
      position: absolute;
      text-align: right;
      width: 2em;
    }

    ul {

      li {

        &:before {
          content: '';
        }

        ol {

          li {
            counter-increment: alt-level;

            &:before {
              content: counter(alt-level) '.';
            }
          }
        }
      }
    }

    ol {

      li {
        counter-increment: sub-level;

        &:before {
          content: counter(top-level) '.' counter(sub-level);
        }

        ul {

          li {

            &:before {
              content: '';
            }
          }
        }

        ol {

          li {
            counter-increment: sub-sub-level;

            &:before {
              content: counter(top-level) '.' counter(sub-level) '.' counter(sub-sub-level);
            }
          }
        }
      }
    }
  }
}


hr {
  background-image: linear-gradient(to bottom,rgba(0, 0, 0, 0) 50%,gray 50%);
  background-position: 0 50%;
  background-repeat: repeat-x;
  background-size: 100% 0.15rem;
  border: 0;
  margin: 0;
  padding-bottom: 3rem;
  padding-top: 3rem;
}

/* Layout */
.container {
  width: 94%;
  max-width: 65rem;
  margin: 0 auto;
  position: relative;
}

.main-col {
  width: 65%;
  float: left;
}

.sidebar {
  width: 35%;
  float: left;
  padding-left: 4rem;
}

/* Demo UI */
* {
  box-sizing: border-box;
}

header {
  height: 4rem;
  padding-right: 2rem;
  text-align: right;
  margin-bottom: 2rem;
  
  span {
    --baselines: 2;
    
    font-family: -apple-system, BlinkMacSystemFont, Aptos, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif;
    margin-right: 1rem;
    line-height: calc(var(--baselines) * 1rem);
    padding-top: calc(calc(calc(var(--baselines) * 1rem) - 1cap) / 2);
    width: 6rem;
    display: inline-block;
    user-select: none;
    transition: 0.3s font-weight;
    text-align: center;
    
    &.active {
      font-weight: 600;
      
      &:hover {
        font-weight: 600;
      }
    }
    
    &:hover {
      cursor: pointer;
      font-weight: 500;
    }
    
    &:last-child {
      margin-right: 0;
    }
  }
}
              
            
!

JS

              
                // JS not needed for baseline alignment, just for demo

// Toggle grid lines
document.getElementById("toggle").addEventListener( 'click' , () => {
  document.documentElement.classList.toggle('show-grid'); 
});

// Switch font palettes
const palettes = document.querySelectorAll("[id^='palette-']");
palettes.forEach(switcher => {
  switcher.addEventListener('click', () => {
    document.body.classList.value = ''
    document.body.classList.add(switcher.id);
    palettes.forEach(switcher => {
      switcher.classList.remove('active');
    });
    switcher.classList.add('active');
  });
});



              
            
!
999px

Console