โœฆ StealThis .dev

CodePen Embed

Lazy-loaded CodePen iframe that defers creation until the user clicks a placeholder, keeping page load fast.

Open in Lab
css javascript
Targets: HTML

Code

CodePen Embed

A lightweight CodePen embed that shows a styled placeholder with the pen title and a โ€œRunโ€ button. The actual <iframe> is only created when the user clicks โ€” keeping Time to Interactive fast on pages with many embeds.

Features

  • Zero iframe cost until user interaction
  • Shows pen title, author, and a preview placeholder
  • Builds the full //codepen.io/.../embed/ URL on click
  • Configurable default tabs (html,css,result etc.)
  • Multiple embeds on the same page stay independent

When to use

  • Documentation pages with live code examples
  • Tutorial or blog posts with interactive demos
  • Any page embedding multiple CodePens