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

              
                <aside>
  <p>🚨 Sorry, your browser doesn't support <code>:has()</code> - view this demo in <a href="https://caniuse.com/css-has" target="_blank">a supported browser</a>.</p>
</aside>

<article>
  <h1>Lorem ipsum dolor sit amet.</h1>
  <p>Quaerat ea corrupti, saepe blanditiis voluptatem ad, velit earum enim ipsum, laborum facere.</p>
  <h2>Lorem ipsum dolor sit amet consectetur.</h2>
  <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Voluptatem asperiores maxime inventore est!</p>
  <p>Expedita consequuntur facere quisquam optio aliquam reiciendis accusantium officiis. Eos, ab. Nemo, numquam.</p>
  <hr>
  <p>Laboriosam, expedita. Pariatur assumenda magni quibusdam beatae cupiditate a ea praesentium officiis quam.</p>
  <p>Quae, voluptatibus quam molestias assumenda earum corporis quis, dolorem aperiam voluptatum minus esse!</p>
  <p>Lorem ipsum dolor sit, amet consectetur adipisicing elit.</p>
  <hr>
  <p>Lorem ipsum dolor sit, amet consectetur adipisicing elit. Eius voluptate consectetur voluptatem odio?</p>
  <h2>Lorem ipsum, dolor sit amet consectetur adipisicing elit.</h2>
  <p>Inventore ducimus asperiores molestiae accusamus. Est aspernatur eligendi dolorum illo fuga eaque itaque.</p>
  <p>Lorem ipsum dolor sit amet consectetur.</p>
  <p>Vero, eligendi possimus numquam aut fugiat, quos molestiae, saepe ducimus optio rem non!</p>
  <h2>Lorem, ipsum dolor.</h2>
  <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Id commodi error excepturi.</p>
  <p>Libero laboriosam harum mollitia tempora sit qui architecto blanditiis!</p>
  <h2>Lorem ipsum dolor sit.</h2>
  <p>Lorem ipsum dolor sit, amet consectetur adipisicing elit.</p>
  <p>Molestias dolore blanditiis corporis quidem illum, magni magnam.</p>
</article>
              
            
!

CSS

              
                /* First and last within a range (of h2) */
article h2 + :has(~ h2),
article h2 ~ :has(+ h2) {
  display: list-item;
  list-style-position: inside;
}

/* First within a range (of h2) */
article h2 + :has(~ h2) {
  list-style-type: "🟢 ";
}

/* Last within a range (of h2) */
article h2 ~ :has(+ h2) {
  list-style-type: "🔴 ";
}

/* All between a single range (of hr) */
article hr ~ :has(~ hr) {
  background-attachment: fixed;
  background-image: linear-gradient(
      to right,
      hsl(0% 100% 100% / 80%) 65%,
      hsl(0% 100% 100% / 40%)
    ),
    repeating-linear-gradient(35deg, #fc31fe 0 2px, white 2px 6px);
}

h1 {
  font-size: clamp(1.45rem, 1rem + 5vw, 3rem);
}

h2 {
  font-size: clamp(1.25rem, 1rem + 4vw, 2.25rem);
}

article {
  width: min(95vw, 60ch);
  background-color: white;

  + article {
    margin-top: 5vh;
  }
}

article :not(hr) {
  padding: 0.75em 1rem;
}

article :where(h1, h2, h3) {
  line-height: 1.1;
}

article :not(h1, h2, h3) {
  line-height: 1.5;
}

article :is(ol, ul) {
  padding-inline-start: 2rem;
  margin-inline-start: 1rem;
}

/* :has() support alert */
aside {
  max-width: 30ch;
  padding: 1rem;
  background-color: palegoldenrod;
  border-radius: 0.5rem;
  margin-inline: auto;
  margin-block: 1rem;
  line-height: 1.3;

  code {
    font-size: 1.25em;
    color: firebrick;
  }
}

@supports selector(:has(+ *)) {
  aside {
    display: none;
  }
}

              
            
!

JS

              
                
              
            
!
999px

Console