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

              
                <section class="fs-l-513">
  <div class="container">
    <div class="content">
      <div class="wrapper-sticky">
        <strong>
          Tagline
        </strong>
        <h2>
          Midjourney Prompt Play
        </h2>
        <p>
          Testing a consistent subject with multiple styles.
        </p>

        <ul class="images-content" id="gsapImagesContent">
          <li>
            <h3>
              01
            </h3>
<code><pre>an evil skeleton playing lead guitar on stage --ar 2:3 --v 6.0</pre></code>
            <img class="hide-at-full" src="https://assets.codepen.io/140/skeleton-01.webp" alt="an evil skeleton playing lead guitar on stage" />
          </li>
          <li>
            <h3>
              02
            </h3>
<code><pre>an evil skeleton playing lead guitar on stage, cinematic, glam rock, metalcore --ar 2:3 --v 6.0</pre></code>
            <img alt="Grey placeholder rectangle" class="hide-at-full" src="https://assets.codepen.io/140/skeleton-02.webp" />
          </li>
          <li>
            <h3>
              03
            </h3>
<code><pre>an evil skeleton playing lead guitar on stage, Linocut print --ar 2:3 --v 6.0</pre></code>
            <img alt="Grey placeholder rectangle" class="hide-at-full" src="https://assets.codepen.io/140/skeleton-03.webp" />
          </li>
          <li>
            <h3>
              04
            </h3>
<code><pre>an evil skeleton playing lead guitar on stage, cyberpunk style, neon glow, dramatic urban skyline, intricate guitar details, X prompt, hd quality, natural look --ar 2:3 --v 6.0</pre></code>
            <img alt="Grey placeholder rectangle" class="hide-at-full" src="https://assets.codepen.io/140/skeleton-04.webp" />
          </li>
        </ul>
      </div>
    </div>
    <div class="show-at-full">
      <ul class="images" id="gsapImages">
        <li>
          <img alt="an evil skeleton playing lead guitar on stage --ar 2:3 --v 6.0" src="https://assets.codepen.io/140/skeleton-01.webp" />
        </li>
        <li>
          <img alt="an evil skeleton playing lead guitar on stage, cinematic, glam rock, metalcore --ar 2:3 --v 6.0" src="https://assets.codepen.io/140/skeleton-02.webp" />
        </li>
        <li>
          <img alt="an evil skeleton playing lead guitar on stage, Linocut print --ar 2:3 --v 6.0 " src="https://assets.codepen.io/140/skeleton-03.webp" />
        </li>
        <li>
          <img alt="an evil skeleton playing lead guitar on stage, cyberpunk style, neon glow, dramatic urban skyline, intricate guitar details, X prompt, hd quality, natural look --ar 2:3" src="https://assets.codepen.io/140/skeleton-04.webp" />
        </li>
      </ul>
    </div>
  </div>
</section>
              
            
!

CSS

              
                .content {
  margin-inline: auto;
  max-width: 600px;
  padding-block: 2rem;
}

.fs-l-513 {
  padding-inline: 1rem;
}

.images-content {
  margin-block-start: 4rem;
}

.show-at-full {
  display: none;
}

@media screen and (min-width: 768px) {
  .container {
    display: grid;
    gap: 2rem;
    grid-template-columns: 1fr 1fr;
    max-inline-size: 1280px;
    margin-inline: auto;
  }
  
  .content {
    margin-inline: 0;
    max-inline-size: auto;
    padding-block-start: 4rem;
  }
  
  .hide-at-full {
    display: none;
  }
  
  .images {
    padding-bottom: 4rem;
  }
  
  .images li img {
    margin-block-start: 5rem;
  }
  
  .images-content {
    display: grid;
  }
  
  .images-content li {
    grid-column-start: 1;
    grid-row-start: 1;
  }
  
  .images-content li:not(:first-child) {
    opacity: 0;
    pointer-events: none; 
  }
  
  .show-at-full {
    display: block;
  }
  
  .wrapper-sticky {
    position: sticky;
    top: 4rem;
  }
}

/* Content Styles */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,100..800;1,100..800&display=swap');

:root {
  --color-bg: linear-gradient(135deg, rgba(8,20,55,1) 0%, rgba(76,94,136,1) 100%);
  --color-bg-code: #28385e;
  --color-text: #cbd5e1;
  --color-heading: #ffffff;
  --shadow: 0 0 0 1px rgba(255, 255, 255, 0.15), 0.75rem 0.75rem 0 #111725;
}

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: "JetBrains Mono", monospace;
  font-optical-sizing: auto;
  font-weight: 300;
  font-style: normal;
  font-size: clamp(1rem, 0.925rem + 0.32vw, 1.125rem);
  line-height: 1.5;
  margin: 0;
}

pre {
  background-color: var(--color-bg-code);
  box-shadow: var(--shadow);
  padding: 1rem;
  white-space: normal;
}

h2, h3 {
  color: var(--color-heading);
}

h2, h3, strong {
  font-weight: 300;
}

h2 {
  font-size: clamp(2.25rem, 1.8rem + 1.92vw, 3rem);
  line-height: 1.25;
  margin-block: 0.5rem;
}

h3 {
  font-size: clamp(1.5rem, -0.3rem + 7.68vw, 4.5rem);
  margin-block-end: 0;
  margin-block-start: 2rem;
}

img {
  box-shadow: var(--shadow);
}

.images-content img {
  margin-block-start: 2rem;
}

.link-button {
  align-items: center;
  border: 1px solid #000;
  display: inline-flex;
  color: #000;  
  justify-content: center;
  padding-inline: 1rem;
  padding-block: 0.5rem;
  text-decoration: none;
}

@media screen and (min-width: 768px) {
  h3 {
    margin-block-start: 0;
  }
}

/* Reset Styles */

* {
  box-sizing: border-box;
}

img {
  display: block;
  height: auto;
  max-inline-size: 100%;
}

ul, li {
  list-style: none;
  margin: 0;
  padding: 0;
}
              
            
!

JS

              
                gsap.registerPlugin(ScrollTrigger);

const imagesContentItems = document.querySelectorAll("#gsapImagesContent li");
const imagesItems = document.querySelectorAll("#gsapImages li");

gsap.matchMedia().add("(min-width: 768px)", function() {
  imagesItems.forEach((image, index) => {
    ScrollTrigger.create({
      trigger: image,
      start: "top center",
      end: "bottom center",
      onEnter: () => {
        gsap.to(imagesContentItems[index], { opacity: 1, y: 0, pointerEvents: "auto", duration: 0.5 });
      },
      onLeave: () => {
        gsap.to(imagesContentItems[index], { opacity: 0, y: -48, pointerEvents: "none", duration: 0.5 });
      },
      onEnterBack: () => {
        gsap.to(imagesContentItems[index], { opacity: 1, y: 0, pointerEvents: "auto", duration: 0.5 });
      },
      onLeaveBack: () => {
        gsap.to(imagesContentItems[index], { opacity: 0, y: 48, pointerEvents: "none", duration: 0.5 });
      },
    });
  });
});
              
            
!
999px

Console