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

              
                <div class="wrapper">
  <figure class="cat1">
    <img src="http://placekitten.com/500/500?image=5" alt="cute kitten">
    <figcaption>
      <h2>Kitten 5</h2>
      <p>Lorem ipsum dolor sit amet.</p>
    </figcaption>
  </figure>
  <figure>
    <img src="http://placekitten.com/500/500?image=6" alt="cute kitten">
    <figcaption>
      <h2>Kitten 6</h2>
      <p>Lorem ipsum dolor sit amet.</p>
    </figcaption>
  </figure>
</div>
  
              
            
!

CSS

              
                figcaption {
  margin-top: -4px;
}
.wrapper {
  display: grid;
  gap: 1%;
}
figure {
  grid-row: 1/2;
  grid-column: 1/2;
  width: 500px;
  justify-self: center;
}
.cat1 {
  animation-name: fade;
  animation-delay: 1s;
  animation-duration: 5s;
  animation-fill-mode: both;
  animation-iteration-count: infinite;
  animation-direction: alternate
}
@keyframes fade {
	0% { 
    opacity: 1;
	}
  25% { 
    opacity: 1;
	}
  75% {
    opacity: 0;
  }
	100% { 
		opacity: 0;

	}
}




/* default styling, no changes needed here */

/* set the layout to border box model */
html {
  box-sizing: border-box;
}
*,
*::before,
*::after {
  box-sizing: inherit;
}
/* set font family and background gradient */
body {
  padding: 0;
  border: 0;
  font-family: Arial, sans-serif;
}

/* Turn off margin, set by browser */
figure {
  margin: 0;
  padding: 0;
}
/* caption styling  */
figcaption {
  background-color: #001219;
  color: white;
  padding: 1rem;
}
/* reduces the top margin on the h2, bottom on the p, and leaves a 0.5rem gap between the two */
figcaption * {
  margin: 0.5rem;
}


              
            
!

JS

              
                /*  
Once again, because Grid allows overlapping cells, you can do all kinds of interesting layout and special effects.

Here, I've used Grid to stack two figures on top of each other. Stacking may be controlled via z-index.

Then I used some simple CSS animation to fade the top kitten in and out. 

The keyframes are set up to show the image as is 25% of the interval, fade from one image to the other between 25-75% of the time interval, and show the last image the final 25% of the interval. Then the animation rocks back the other way to fade in the kitten again.

*/
              
            
!
999px

Console