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.


                <div style="display: flex; justify-content: center; gap: 0.5rem; padding: 1rem;">
  <button id="add">Add</button>
  <button id="remove">Remove</button>

<div class="wrapper">
  <article class="post">
    <div class="category">Fun stuff</div>
    <h3 class="title">CSS is awesome, and you know it. Right?</h3>
    <div class="meta">
      <p>Ahmad Shadeed</p>
      <time class="river-byline__full-date-time" datetime="2023-08-03T14:20:14">5:20 PM GMT+3<span class="full-date-time__separator">•</span>August 3, 2023</time>

    <div class="desc">
      planet moon rabbit date astronaut rabbit tomato cherry parrot kiwi cat quince hazelnut planet pear monitor elderberry cucumber grape galaxy cat parrot cat

    <figure class="media">
        <source srcset=";h=53&amp;crop=1 100w" media="(max-width: 380px)">
        <source srcset=";h=107&amp;crop=1 200w" media="(max-width: 575px)">
        <source srcset=";h=230&amp;crop=1 430w" media="(min-width: 576px)"><img alt="Worldcoin Project Co-founders Alex Blania (L) and Sam Altman (R)" sizes="(min-width: 1024px) 430px, 100vw" src=";h=230&amp;crop=1" srcset=";h=53&amp;crop=1 100w,;h=107&amp;crop=1 200w,;h=230&amp;crop=1 430w">

  <hr class="spacer">



                .post {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: max-content max-content 50px;
  column-gap: 1rem;

.title {
  font-weight: bold;
  font-size: 2rem;
  line-height: 1;
  grid-column: 1/2;
  padding-block: 0.5rem;

.meta {
  grid-column: 1/2;

  p {
    font-weight: bold;

.desc {
  grid-column: 2/3;
  grid-row: 1/-1;
  color: #777;

.media {
  grid-row: 1/-1;
  grid-column: 3/4;
  position: relative;
  height: fit-content;

  &:after {
    content: "";
    position: absolute;
    inset: 0;
    background: lightgrey;

.category {
  color: #00d301;

time {
  color: #777;

.wrapper {
  max-width: 850px;
  margin: 1rem auto;
  padding-block: 1rem;

/* other styles */
.spacer {
  height: 2rem;
  border: 0;

body {
  font-family: system-ui;
  line-height: 1.45;

* {
  box-sizing: border-box;

img {
  max-width: 100%;



                document.addEventListener("DOMContentLoaded", function () {
  const words = [
    "guinea pig",

  const addBtn = document.getElementById("add");
  const removeBtn = document.getElementById("remove");
  const postContent = document.querySelector(".desc");

  addBtn.addEventListener("click", function () {
    for (let i = 0; i < 5; i++) {
      const randomIndex = Math.floor(Math.random() * words.length);
      const randomWord = words[randomIndex];
      const wordElement = document.createElement("span");
      wordElement.textContent = randomWord + " ";

  removeBtn.addEventListener("click", function () {
    const wordElements = postContent.querySelectorAll("span");
    if (wordElements.length > 5) {
      for (let i = 0; i < 5; i++) {