cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation


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.

              <div class="container">
  <h1>Click-to-enable iframes</h1>
  <p>This impress.js-based slideshow adds over 2mb of page weight to this host page, but most people will never go past the first frame which has similar content to the host page that introduces it. So, why not load the presentation on-demand, only for those
    who really want to see it?</p>

  <div class="responsive-iframe-wrapper">
    <div class="iframe-placeholder" data-src="//www.imakewebsites.ca/slides/fun-with-firebase/#/">enable slideshow</div>

  <h2>Video Embeds</h2>
  <p>This YouTube embed adds 543kb of weight page. At least 415kb is heavily cached, but it all has to be processed by your browser. You can fake the embed it by loading the video's thubmail image and putting your own play button on top. Setting the embed
    to autoplay avoids adding an extra click to start the video, at least on desktop browsers. </p>
  <div class="responsive-iframe-wrapper">

    <div class="iframe-placeholder" data-src="https://www.youtube.com/embed/u49sj-T86Os?autoplay=1" style="background: transparent url('https://i.ytimg.com/vi/0YoepA9pbKk/maxresdefault.jpg') center center; background-size:cover">
      <svg height="50" width="50" xmlns="http://www.w3.org/2000/svg" viewbox="0 0 96 96"><path class="youtube-play-btn" fill="#888" d="M94.98,28.84c0,0-0.94-6.6-3.81-9.5c-3.64-3.81-7.72-3.83-9.59-4.05c-13.4-0.97-33.52-0.85-33.52-0.85s-20.12-0.12-33.52,0.85c-1.87,0.22-5.95,0.24-9.59,4.05c-2.87,2.9-3.81,9.5-3.81,9.5S0.18,36.58,0,44.33v7.26c0.18,7.75,1.14,15.49,1.14,15.49s0.93,6.6,3.81,9.5c3.64,3.81,8.43,3.69,10.56,4.09c7.53,0.72,31.7,0.89,32.54,0.9c0.01,0,20.14,0.03,33.54-0.94c1.87-0.22,5.95-0.24,9.59-4.05c2.87-2.9,3.81-9.5,3.81-9.5s0.96-7.75,1.02-15.49v-7.26C95.94,36.58,94.98,28.84,94.98,28.84z M38.28,61.41v-27l25.74,13.5L38.28,61.41z"/></svg>
  <p>Works in:</p>
    <li>Chrome 60</li>
    <li>IE 11</li>
    <li>Edge 14</li>
    <li>Firefox 47</li>
    <li>Safari 10.1.2</li>
              body {

h1, h2 {

.container {

.responsive-iframe-wrapper {
    float: none;
    clear: both;
    width: 100%;
    position: relative;
    padding-bottom: 56.25%;
    padding-top: 25px;
    height: 0;

    &.portrait {
      padding-bottom: 177%;

  iframe, .iframe-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;

.iframe-placeholder {
  &:hover {

.iframe-placeholder {
   .youtube-play-btn {

   &:hover .youtube-play-btn {

iframe {

iframe.loading {
  // loader from http://samherbert.net/svg-loaders/
  background:#333 url('https://cdn.rawgit.com/SamHerbert/SVG-Loaders/75b65ef5/svg-loaders/spinning-circles.svg') center center no-repeat;
  background-size: 40px 40px; 
              var placeholders = document.querySelectorAll(".iframe-placeholder");

for (let i = 0; i < placeholders.length; i += 1) {
  const placeholder = placeholders[i];
  // set up the listener on the placeholder
  placeholder.addEventListener("click", configureIframePlaceholder, {
    once: true

function configureIframePlaceholder(event) {
  const iframe = document.createElement("iframe");

  const placeholder = event.target;
  // iframes have load events, so use them for progress indicators
    function() {
    // if a browser doesn't support options here, it will interpret this as a true for the useCapture parameter which is OK  in this use case
    { once: true }

  iframe.src = placeholder.dataset.src;
  iframe.allowfullscreen = "allowfullscreen";

  // swap placeholder for new iframe
  placeholder = null;

🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................