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. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource


Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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


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.


                <section class="hero">
  <h1 class="hero__title">
    Hey there!<br>
    Did you know we can really code this with just <strong>z-index: 1</strong>?
  <div class="hero__circle"></div>
  <div class="hero__circle hero__circle--large"></div>
  <img class="hero__image" src="" alt="" />

<button id="openBtn">Open modal</button>

<div id="modal" class="modal modal--visible">
  <div class="modal__body">
    <h2>A modal</h2>
    <button id="closeBtn">Close modal</button>


                body {
  text-align: center;

* {
  box-sizing: border-box;

.hero {
  max-width: 28rem;
  margin: 2.5rem auto 6rem;
  padding: 3rem 8rem 0 0;
  position: relative;
  z-index: 1;

  &__title {
    font-family: sans-serif;
    font-size: 2rem;
    text-align: left;
    position: relative;
    z-index: 9999;

    strong {
      text-decoration: underline;

  &__image {
    position: absolute;
    top: 0;
    right: 2rem;
    height: 25rem;

  &__circle {
    position: absolute;
    top: 1.5rem;
    right: 60%;
    width: 4rem;
    height: 4rem;
    background: #f4d10b;
    border-radius: 50%;
    opacity: 0.9;

    &--large {
      width: 15rem;
      height: 15rem;
      top: 5rem;
      right: 0;

.modal {
  position: fixed;
  z-index: 1;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: none;

  &--visible {
    display: flex;
    justify-content: center;
    align-items: center;

  &__body {
    width: 10rem;
    height: 10rem;
    padding: 1rem;
    text-align: center;
    background: #fff;



                const openBtn = document.getElementById("openBtn");

const closeBtn = document.getElementById("closeBtn");

const modal = document.getElementById("modal");

openBtn.addEventListener("click", () => {

closeBtn.addEventListener("click", () => {